diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2008-07-15 14:27:37 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2008-07-15 14:27:37 (GMT) |
commit | 53663a695ef2bb96ac0252cd4cc4aa40d4f953be (patch) | |
tree | e241ef71b353f8b3162179b1eed5a3f4eaae0c5f /Lib/sets.py | |
parent | 9ace15ca25e1e72e1b943190a5f4efbd7d118de3 (diff) | |
download | cpython-53663a695ef2bb96ac0252cd4cc4aa40d4f953be.zip cpython-53663a695ef2bb96ac0252cd4cc4aa40d4f953be.tar.gz cpython-53663a695ef2bb96ac0252cd4cc4aa40d4f953be.tar.bz2 |
Issue 2235: __hash__ is once again inherited by default, but inheritance can be blocked explicitly so that collections.Hashable remains meaningful
Diffstat (limited to 'Lib/sets.py')
-rw-r--r-- | Lib/sets.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/sets.py b/Lib/sets.py index 99ee931..b1743da 100644 --- a/Lib/sets.py +++ b/Lib/sets.py @@ -439,10 +439,8 @@ class Set(BaseSet): def __setstate__(self, data): self._data, = data - def __hash__(self): - """A Set cannot be hashed.""" - # We inherit object.__hash__, so we must deny this explicitly - raise TypeError, "Can't hash a Set, only an ImmutableSet." + # We inherit object.__hash__, so we must deny this explicitly + __hash__ = None # In-place union, intersection, differences. # Subtle: The xyz_update() functions deliberately return None, |