Terry Reedy writes: > If you want to duplicate 2.x behavior, which does *not* work for all > types... > > def py2key(item): return (str(type(item)), item)
Nope. sorted((-1, 2, True, False)) == [-1, False, True, 2] sorted((-1, 2, True, False), key=py2key) == [False, True, -1, 2] Might often be good enough though. But uses more memory. -- Hallvard -- http://mail.python.org/mailman/listinfo/python-list