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

"Martin v. Löwis" martin at v.loewis.de
Fri Nov 25 17:39:19 EST 2005


Christoph Zwerschke wrote:
> You need to know a third thing, namely that as an iterable object, a 
> dictionary returns the keys only, not the key/value tuples which would 
> also make some sense. If it had been designed that way, you could write

Right. I forgot to say that, but that is also explained in PEP 234.

Regards,
Martin



More information about the Python-list mailing list