True lists in python?

Vito 'ZeD' De Tullio zak.mc.kraken at libero.it
Sun Dec 19 01:48:54 EST 2010


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




More information about the Python-list mailing list