Sorting part of a list
Fuzzyman
fuzzyman at gmail.com
Fri Jun 24 08:07:54 EDT 2005
You can assign to a slice in place, but referencing a slice creates a
copy.
I think you understand it quite well :-)
a = ll[2:]
a.sort()
ll[2:] = a
To do a partial sort, in place, you'll have to subclass list - but
you'll still end up doing something similar unless you delve into C or
write your own sort algorithm in Python. Neither are recommended.
Best Regards,
Fuzzy
http://wwww.voidspace.org.uk/python
(back online hurrah)
More information about the Python-list
mailing list