[issue9080] Provide list prepend method (even though it's not efficient)

2010-09-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry, this needs to stay closed. It has no chance. -- nosy: +rhettinger ___ Python tracker ___ _

[issue9080] Provide list prepend method (even though it's not efficient)

2010-09-07 Thread sorin
sorin added the comment: +1 for adding it because it will make the code easier to read/understand. Bad performance could be documented and it's related about internal representation. -- nosy: +sorin ___ Python tracker

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Andy Buckley
Andy Buckley added the comment: Still not convinced with the reasoning, I'm afraid, but I certainly agree that modifications to built-ins are not to be made lightly. Using deques, which are far less familiar, is not a particularly natural thing to do for a search path, and of course can't be

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Ezio Melotti
Ezio Melotti added the comment: Here: http://docs.python.org/py3k/tutorial/datastructures.html#using-lists-as-queues -- ___ Python tracker ___ __

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Georg Brandl
Georg Brandl added the comment: [insert the usual reference to collections.deque here] -- nosy: +georg.brandl ___ Python tracker ___ _

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: > 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. Not quite. First let's consider the insert approach. Unlike

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Mark Dickinson
Mark Dickinson added the comment: Andy, the bug-tracker isn't really the best place for this sort of discussion; if you want to take this further I'd suggest mailing the python-ideas mailing list (bigger audience). FWIW, the bar for adding new methods to builtins should be pretty high; I agr

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Ezio Melotti
Ezio Melotti added the comment: If we add a .prepend() method, people will see it and start using it. Since now there's no 'prepend' method people ask why, and the answer they usually get is "because it not a good idea to add elements on lists (but if you really have to use the 'insert' metho

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Andy Buckley
Andy Buckley added the comment: 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

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: Thanks for bringing this up. I think you have more work to do to successfully make the case that L.insert(0, x) is "difficult" enough to merit the addition of a new list method. There are already at least two in-place insert-at-front list APIs (the seco

[issue9080] Provide list prepend method (even though it's not efficient)

2010-06-25 Thread Andy Buckley
New submission from Andy Buckley : I know that Python lists aren't designed for efficient prepending, but sometimes when working with small lists it's exactly what needs to be done (search path lists being a common example). For a programmer aware of the performance issue and having convinced