list.pop(0) vs. collections.dequeue

Steve Howell showell30 at yahoo.com
Fri Jan 22 17:52:41 EST 2010


On Jan 22, 1:32 pm, Terry Reedy <tjre... at udel.edu> wrote:
> On 1/22/2010 2:14 PM, Steve Howell wrote:
>
> > The v2.6.4 version of the tutorial says this:
> > Is that really true in CPython?  It seems like you could advance the
> > pointer instead of shifting all the elements.  It would create some
> > nuances with respect to reclaiming the memory, but it seems like an
> > easy way to make lists perform better under a pretty reasonable use
> > case.
>
> Something like this was one proposed (ie, leave space at both ends of a
> list) but was rejected as over-complicating the list implementation for
> *relatively* rare use cases. I believe deque was written subsequently to
> address such other use cases.

Bummer.  I guess I get to do my own over-complicating of code, being
in that unfortunate minority.





More information about the Python-list mailing list