Why is dictionary.keys() a list and not a set?
Christoph Zwerschke
cito at online.de
Thu Nov 24 15:13:57 EST 2005
Mike Meyer schrieb:
> If the hash changes, you've screwed up the set. What it really should
> say is "collection of objects with fixed hashes", or words to that
> effect. Do you want to file a PR on this?
I fear I have not enough understanding of Python's hashing concepts to
make a suggestion for improvement here.
> How so? As I demonstrated, you can subclass any class that doesn't
> have a hash to add one, and then use the subclass, which - except for
> having a hash - will have exactly the same behavior as your original
> class.
But you surely wouldn't want to do this to the list of items just to be
able to return it as a set.
-- Christoph
More information about the Python-list
mailing list