Why is dictionary.keys() a list and not a set?

Christoph Zwerschke cito at online.de
Sat Nov 26 11:44:25 CET 2005

Mike Meyer wrote:

> Ok, how about this for dictionaries/sets:
> Any hashable object can be used as a dictionary key (set member). Immutable
> objects, except for tuples that contain a non-hashable object, are
> hashable. Python classes are normally hashable(1).

The problem with the last sentence is that can be misunderstood (classes 
themselves as objects are always hashable) and has little information 
otherwise (what is "normal"?).

-- Christoph

More information about the Python-list mailing list