[Tutor] Sorting more than one list

Max Noel maxnoel_fr at yahoo.fr
Fri Apr 1 10:04:02 CEST 2005


On Apr 1, 2005, at 09:59, Alan Gauld wrote:

> Since the data are obviously related (since you need to keep them
> linked),
> I'd be inclined to merge the lists into a list of tuples
>
> merged = [(a,b,c,d) for a in l1 for b in l2 for c in l3 for d in l4]
>
> Then you can sort 'merged' and it should just work.... The default
> sort will order the tuples by the first member...
>
> Alan G.

	What's the advantage of this compared to the "zip" method (which 
yields the same result AFAICT)?

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"




More information about the Tutor mailing list