Are Python deques linked lists?

Neil Cerutti horpner at yahoo.com
Tue Dec 11 10:41:01 EST 2007


On 2007-12-11, Duncan Booth <duncan.booth at invalid.invalid> wrote:
> Neil Cerutti <horpner at yahoo.com> wrote:
>> If you put an instrumented iterator through, say, reversed or
>> sorted, you'd lose the ability to use it to modify the list
>
> I think that is kind of irrelevant. reversed doesn't take an
> iterator, it requires a sequence and returns an iterator.
> sorted will take an iterator but it always returns a new list.

Thank you! Strangely enough I didn't know either of those things.
I've been using sorted as if it were a generator, and I guess
I've never used reversed on an iterator before.

>> I do have one last question about a doubly-linked list. Would you
>> have to perform any tricks (del statements) to get the garbage
>> collector to collect every node, or will it just work?
>
> It should just work.

Cool.

-- 
Neil Cerutti
I am free of all prejudices. I hate everyone equally. --W. C. Fields



More information about the Python-list mailing list