George Sakkis: > but I guess there's not much more room for improvement.
That's nonsense, Python is a high level language, so there's nearly always room for improvement (even in programs written in assembly you can generally find faster solutions). If speed is what you look for, and your strings are ASCII then this is much faster: tab = "".join(map(chr, xrange(256)))[::-1] s.sort(key=lambda x: x.translate(tab), reverse=True) Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list