[Tutor] __getitem__

monikajg at netzero.net monikajg at netzero.net
Wed Nov 23 01:09:16 EST 2016


Hi:
Can you please explain __getitem__? My understanding is that it brings back dictionary's value. Is this correct? If so which value does it bring? Does it look up this value by using a key? Where is this key specified in  " numbers.__getitem__"   ?

The below supposedly brings back dictionary's keys list  sorted by values. But how does it do it?

numbers = {'first': 1, 'second': 2, 'third': 3, 'Fourth': 4}
sorted(numbers, key=numbers.__getitem__)

Thank you very much
Monika


____________________________________________________________
3 Signs You May Have a Fatty Liver [Watch]
livecellresearch.com
http://thirdpartyoffers.netzero.net/TGL3241/583532f442b7c32f440b1st04duc


More information about the Tutor mailing list