PEP 372 -- Adding an ordered directory to collections

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Jun 17 07:21:20 EDT 2008


Martin v. L.:
> http://wiki.python.org/moin/TimeComplexity

Thank you, I think that's not a list of guarantees, while a list of
how things are now in CPython.


> If so, what's the advantage of using that method over d.items[n]?

I think I have lost the thread here, sorry. So I explain again what I
mean. I think for this data structure it's important to keep all the
normal dict operations at the same speed. If you use a C
implementation vaguely similar to my pure python recipe you can
perform the del in O(1) too, because pairs are joined in (double)
linked list. But such data structure is O(n) to find the n-th item
inserted into the sequence.

Bye,
bearophile



More information about the Python-list mailing list