True lists in python?

Antoine Pitrou solipsis at pitrou.net
Sun Dec 19 16:54:55 EST 2010


On Sun, 19 Dec 2010 20:45:55 +0100
Stefan Sonnenberg-Carstens <stefan.sonnenberg at pythonmeister.com> wrote:
> Am 19.12.2010 07:18, schrieb Dmitry Groshev:
> > 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.
> reversing part of the list could also be interpreted as reading it
> in the opposite direction from a given starting point to a known end.
> 
> Perhaps you want to look into the array module, but you
> have to  sacrifice the typelessness of a true python list:
> it can only contain numerical data (also char, byte).
> 
> But don't know the timing pattern of array objects, only that they are *way*
> faster then lists.

Why do you say there're much faster?

Regards

Antoine.





More information about the Python-list mailing list