This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andybuckley
Recipients andybuckley, exarkun
Date 2010-06-25.12:23:49
SpamBayes Score 0.0011660685
Marked as misclassified No
Message-id <1277468633.48.0.931938884245.issue9080@psf.upfronthosting.co.za>
In-reply-to
Content
Maybe I just value method symmetry/equivalence higher than the designers when it comes to interface expectations. I've seen several "I expected there to be a prepend() method like append() on lists, but there isn't -- what do I do?" emails on list archives when searching for info on this, which I think is in itself a hint that the current situation is counter-intuitive.

The argument that "there are already two ways to do it, so why add a third?", is not bad, but if applied to appending, it would ban the append() method... except that it's already there. Personally, the behaviour of append() is very familiar, while insert(0, ...) is less-used and I always have to explicitly confirm to myself that it isn't going to overwrite the zeroth existing element. Adding a prepend(x) method which just calls insert(0, x) (or calls the same underlying C function) would change nothing in terms of code efficiency -- bad programmers will always write inefficient code, one way or another -- but would make the list API more intuitive and improve code readability: seems to me like the sort of thing that Python is philosophically into ;)

Sorry to bring up this issue that I guess has been raised (many times?) before, but I thought I'd have a stab at a convincing case!
History
Date User Action Args
2010-06-25 12:23:53andybuckleysetrecipients: + andybuckley, exarkun
2010-06-25 12:23:53andybuckleysetmessageid: <1277468633.48.0.931938884245.issue9080@psf.upfronthosting.co.za>
2010-06-25 12:23:50andybuckleylinkissue9080 messages
2010-06-25 12:23:49andybuckleycreate