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

jepler at unpythonic.net jepler at unpythonic.net
Thu Nov 24 03:00:12 CET 2005


You can already get a set from a dictionary's keys in an efficient manner:
>>> l = dict.fromkeys(range(10))
>>> set(l)
Set([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051123/747406ab/attachment.pgp>


More information about the Python-list mailing list