[Python-Dev] collections module
Jeremy Fincher
fincher.8 at osu.edu
Fri Jan 9 13:09:07 EST 2004
On Jan 9, 2004, at 12:32 AM, Raymond Hettinger wrote:
> The second type would be a high speed queue implemented using
> linked list blocks like we used for itertools.tee(). The
> interface could be as simple as push, pop, and len. Each
> operation ought to run about as fast a list assignment (meaning
> that it beats the heck out of the list.pop(0), list.append(data)
> version).
That's great, though I'd beg that the methods push/pop be named
enqueue/dequeue. I can imagine the confusion that would result from
read code that used .pop() to clear out a queue -- people very possibly
wouldn't be able to tell whether the data structure being used is a
queue or a stack.
Jeremy
More information about the Python-Dev
mailing list