lists and sequences
Gerhard Häring
gerhard at bigfoot.de
Tue Jun 11 19:55:46 EDT 2002
Collin Monahan wrote in comp.lang.python:
> What is a python list? Is it a linked list or a random access structure
> in contiguous memory?
This type of questions can be easily answered by looking into its
implemenation (Objects/listobject.c).
> What type of situations should be avoided when using it?
Checking for containment using the 'in' operator.
> E.g. when does n^2 time happen using it? What sorting algorithm is
> used by its sort member function?
Read the Source, Luke. Looks like 'samplesort' (never heard of), and
quicksort are used, among others. IOW, it's pretty damn well
optimized.
> Are the answers to these questions the same for Jython?
Read the Source, Luke. Looks like it's a combination of quicksort and
insertion sort.
Gerhard
--
mail: gerhard <at> bigfoot <dot> de registered Linux user #64239
web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9 3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
More information about the Python-list
mailing list