True lists in python?

Dmitry Groshev lambdadmitry at gmail.com
Sun Dec 19 02:12:43 EST 2010


On Dec 19, 9:48 am, Vito 'ZeD' De Tullio <zak.mc.kra... at libero.it>
wrote:
> Dmitry Groshev wrote:
> > Is there any way to use a true lists (with O(c) insertion/deletion and
> > O(n) search) in python? For example, to make things like reversing
> > part of the list with a constant time.
>
> if you're interested just in "reverse" a collection maybe you can take a
> look at the deque[0] module.
>
> If you want "true lists" (um... "linked list"?) there are is this recipe[1]
> you might look.
>
> [0]http://docs.python.org/library/collections.html#collections.deque
> [1]http://code.activestate.com/recipes/577355-python-27-linked-list-vs-
> list/
>
> --
> By ZeD

-I can't find any information about reverse's complexity in python
docs, but it seems that deque is a linked list. Maybe this is the one
I need.
-Yes, I meant linked list - sorry for misunderstanding.
-Linked list on objects is too slow. It must be a C-extension for a
proper speed.



More information about the Python-list mailing list