Hi:
Can you please explain what is going on below? I do not understand how 
numbermap.__getitem__ brings back month's key.
Does numbermap.__getitem__ bring back numbermap key or value? If key then it is 
not consistent with my understanding of problem in my previous email.  So month 
is sorted by numbermap values or keys?


month = dict(one='January',
                 two='February',
                 three='March',
                 four='April',
                 five='May')
numbermap = {'one': 1, 'two': 2, 'three': 3, 'four': 4, 'five': 5}
sorted(month, key=numbermap.__getitem__)
['one', 'two', 'three', 'four', 'five']
This is from:
http://pythoncentral.io/how-to-sort-python-dictionaries-by-key-or-value/
____________________________________________________________
Which Haircuts Look Exceptional on Older Women?
starsgossip.com
http://thirdpartyoffers.netzero.net/TGL3241/583536c537dff36c4036dst01duc
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to