is this sort method the same as the one in python 2.4
Raymond Hettinger
vze4rx4y at verizon.net
Sun Jan 30 18:14:09 EST 2005
"Pedro Werneck"
>
> What about this ?
>
>
> #
> if sys.version_info >= (2,4):
> def sorted(iterable, *args, **kwds):
> seq = list(iterable)
> seq.sort(*args, **kwds)
> return seq
> #
>
> It worked against the TestSorted in lib/test/test_builtins.py
The key= and reverse= parameters were introduced to list.sort() in Py2.4.
Consequently, the above code won't provide the desired functionality in Py2.3
and prior.
Raymond Hettinger
More information about the Python-list
mailing list