in reply to (OT) The Schwartzian Transform in Java
And just to make it clear that dynamically typed languages have it all over statically typed languages, here's an ST in python to guarantee a stable sort:
def stable_sort(some_list, indices=xrange(sys.maxint)): decorated = zip(list,indices) decorated.sort return [item for item, index in decorated]
In fact, in the Python Cookbook, this is even referred to as a Schwartzian Transform.
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|