In message <8h9ob9fku...@mid.individual.net>, Gregory Ewing wrote: > 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.
Hmm. It seems that “iter(<dict>)” iterating over the keys has been around a long time. But a dict has both keys and values: why are language constructs treating them so specially as to grab the keys and throw away the values? Is this an artifact of older directions in the language evolution, before sets were introduced? -- http://mail.python.org/mailman/listinfo/python-list