sorting dictionary keys?

Bruno Desthuilliers bdesth.nospam at
Sat Nov 29 23:34:25 CET 2003

Jay O'Connor wrote:
> John Smith wrote:
>  > Hi, what's the fastest way (least amount of typing)
> Never good criteria
>> but I would like to do:
>> #error here
>> for k in d.keys().sort():
>>    print k, d[k]
>> why doesn't the nested function call work?  Thanks in advance.
> sort() sorts in place and returns None

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).


More information about the Python-list mailing list