sorting dictionary keys?

Bruno Desthuilliers bdesth.nospam at removeme.free.fr
Sat Nov 29 17:34:25 EST 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
> 

<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





More information about the Python-list mailing list