[EMAIL PROTECTED] wrote:
> Your solution Steven Bethard looks very intelligent, here is a small
> speed test, because sorting a list according another one is a quite
> common operation.
> (Not all solutions are really the same, as Alex has shown).

Try this one.


def psort10(s1, s2):
     d = dict(zip(s2,s1))
     s1[:] = (d[n] for n in sorted(d.keys()))


It's faster on my system because d.keys() is already sorted.  But that 
may not be the case on other versions of python.

Ron

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to