O'Reilly logo
  • Sri Harsha V thinks this is interesting:

User-defined class instance objects (discussed in Part VI) can also be used as keys, as long as they have the proper protocol methods; roughly, they need to tell Python that their values are “hashable” and thus won’t change, as otherwise they would be useless as fixed keys. Mutable objects such as lists, sets, and other dictionaries don’t work as keys, but are allowed as values.

From

Cover of Learning Python, 5th Edition

Note

Important point regarding what can be made a key in Python dictionary. They should be IMMUTABLE!!!