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

Christoph Zwerschke cito at online.de
Thu Nov 24 13:02:24 EST 2005


>>- Because sets can only contain immutable values

Mike Meyer wrote:

> Not true. Sets can only contain *hashable* objects, which isn't the
> same thing.

I trusted the doco which defines a set as "an unordered collection of 
immutable values" (http://docs.python.org/lib/types-set.html).

Anyway, the problems stays the same.

-- Christoph



More information about the Python-list mailing list