list.pop(0) vs. collections.dequeue

Paul Rubin no.email at nospam.invalid
Mon Jan 25 02:24:30 EST 2010


Steve Howell <showell30 at yahoo.com> writes:
> There is nothing wrong with deque, at least as far as I know, if the
> data strucure actually applies to your use case.  It does not apply to
> my use case.

You haven't explained why deque doesn't apply to your use case.  Until a
convincing explanation emerges, the sentiment you're creating seems to
be "what's wrong with that guy and why doesn't he just use deque?".  So,
why aren't you using deque?  If deque somehow isn't adequate for your
use case, maybe it can be improved.

>> Your approach of snarling against list is not persuading
>> anyone that list needs to be changed, because most everyone is satisfied
>> with the existing solution.  
>
> Please provide evidence of that.  I am pretty sure that everybody who
> chooses alternatives to Python would disagree.

I've heard of many reasons to choose alternatives to Python, and have
chosen alternatives to Python in various situations myself.  The
list.pop(0) issue has never been one of those reasons for me or anyone
else I know of to choose an alternative until you came along.  Anyway,
you're welcome to switch to another language; nobody's heart will be
broken if you do that.  I'd be interested to know which languages handle
list.pop(0) the way you're proposing for Python.

>> And when discussing performance in this context, additive constants
>> do matter.

> Wrong again.  Operations that mutate lists are already expensive

I'm talking about memory consumption, which is part of Python's concept
of performance.  You're proposing adding a word or two to every list,
with insufficient justification presented so far.  Any such
justification would have to include a clear and detailed explanation of
why using deque is insufficient, so that would be a good place to start.

On another note: the idea you're suggesting, while not yet 100%
convincing, is not crazy, which is why people are willing to discuss it
with you reasonably.  But your confrontational style is making
discussion unpleasant.  Can you dial it back a little?  Your current
approach is perhaps leading you towards people's ignore lists.



More information about the Python-list mailing list