list.pop(0) vs. collections.dequeue
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Sun Jan 24 06:20:09 EST 2010
On Sun, 24 Jan 2010 02:33:36 -0800, Steve Howell wrote:
> You are also a brilliant computer scientist, despite the fact that you
> are defending a list implemenation that can't pop the first element off
> the list in O(1) time.
You say that like it's a bad thing.
It's very simple: the trade-offs that the Python development team have
deliberately chosen aren't the same trade-offs that you prefer. That
doesn't make your trade-offs right and Python's wrong. They're just
different, and if Python lists had your preferred implementation, I
guarantee that somebody would be complaining about it right now.
If you're serious about wanting O(1) pops from the start of the list,
write your own list implementation and use it. You might even like to
make it public, so others can use it as well. But please stop with the
snide remarks and poorly disguised insults and back-handed compliments,
it's getting tedious.
Or just change your algorithm slightly -- it's not hard to turn an
algorithm that pops from the start of a list to one that pops from the
end of the list.
--
Steven
More information about the Python-list
mailing list