[Python-Dev] collections module

Martin v. Loewis martin at v.loewis.de
Sat Jan 10 18:34:29 EST 2004


Kurt B. Kaiser wrote:
> With a circular buffer approach, the headpointer and tailpointer will
> walk down the block and when the end is reached the tailpointer will
> wrap around and "appended" items will be stored at the low end of the
> block.  The process continues without any copying.

I think you two are talking about completely different things.

Tim is talking about a modification to the builtin list type.

You are talking about a new data type for queues.

You are both right: Changing the list type to leave space in the front
would make it more efficient for implementing queues than the current
list type, especially if people use the standard idiom. Using a new
type would be even more efficient if the queue is bounded.

I'm still opposed to adding a new queue type, because it complicates
the library, and it does not give any benefit to existing code -
one actually has to change the existing implementations of queues.
People don't want to change their code, especially if they need
to support old Python versions. So changing the list type looks more
promising to me.

Not taking any action might be acceptable as well.

Regards,
Martin




More information about the Python-Dev mailing list