outline-style sorting algorithm

Max M maxm at mxm.dk
Mon Apr 19 13:50:18 EDT 2004


jwsacksteder at ramprecision.com wrote:

> Am I understanding correctly that python has an implict notion that position
> in a list denotes order of magnitude? Batteries included- Big Win!

Almost. But you can have multi digit numbers at each position.

 >>> l = [
... [4242,42,42],
... [42,4242,42],
... ]
 >>> l.sort()
 >>> l
[[42, 4242, 42], [4242, 42, 42]]


It actually just sorts a list of lists, where the value of each item 
decides the sort order.

regards Max M


-- 

hilsen/regards Max M, Denmark

http://www.mxm.dk/
IT's Mad Science




More information about the Python-list mailing list