sorting dictionary keys?

Raymond Hettinger vze4rx4y at verizon.net
Sun Nov 30 07:30:40 CET 2003


> > sort() sorts in place and returns None
> >
>
> <rant>
> Which is one of the main PITA in Python IMHO :(
> (not the fact that it sort in place, the fact that it does not return self).
> </rant>
>
> Bruno


Wish granted!

Py2.4 will have a classmethod called list.sorted() that accepts any
iterable as an argument and returns a new sorted list as a result.
It can be used anywhere you can use an expression (function call
arguments, lambdas, list comps, etc).


Raymond Hettinger






More information about the Python-list mailing list