[Tutor] how to sort a dictionary by values

Tiger12506 keridee at jayco.net
Wed Aug 8 07:02:03 CEST 2007


> Just curious: Is there a reason to use __getitem__() over itemgetter (used 
> in the example in my reply)?

__getitem__ is a method builtin to a dict object. itemgetter 1) has to be 
imported 2) is more generically used, therefore probably using a more 
generic/slower algorithm

JS 



More information about the Tutor mailing list