sorting many arrays from one...

Shagshag13 shagshag13 at yahoo.fr
Tue Jul 9 10:15:45 EDT 2002


"Duncan Booth" <duncan at NOSPAMrcp.co.uk>
Alex Martelli <aleax at aleax.it>

thanks to you two !

so if i want to do this in a generic function, i should use something like :

def sortManyFromOne(driven, compare = None, *others):

 aux = zip(driven, *others)
 if compare is None:
  aux.sort()
 else:
  aux.sort(compare)
 driven, *others = map(list, zip(*aux))

but this last line don't work and i don't know how to fix it... unless i replace it by :

return map(list, zip(*aux))

is it a good idea if we consider that my "driven" and "others" could contain more than 300,000 elements each ?
(i'm thinking of using array.array instead of list)

s13.





More information about the Python-list mailing list