Help with sets

Gregory Ewing greg.ewing at canterbury.ac.nz
Fri Oct 8 19:37:46 EDT 2010


Lawrence D'Oliveiro wrote:

> Did you know that applying the “set” or “frozenset” functions to a dict 
> return a set of its keys?

> Seems a bit dodgy, somehow.

That's just a consequence of the fact that dicts produce their
keys when iterated over, and the set constructor iterates over
whatever you give it.

-- 
Greg



More information about the Python-list mailing list