summaryrefslogtreecommitdiff
path: root/Lib/sets.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2008-07-15 14:27:37 +0000
committerNick Coghlan <ncoghlan@gmail.com>2008-07-15 14:27:37 +0000
commitb3bff4d81624cec238bd877d3b26d8acf85ae573 (patch)
treee8a417fd69c7c6f762dc094e8e1a5dd175fda2fd /Lib/sets.py
parent36878cb9554d221b6b009957ea7cb95591bd59a7 (diff)
downloadcpython-b3bff4d81624cec238bd877d3b26d8acf85ae573.tar.gz
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.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/Lib/sets.py b/Lib/sets.py
index 99ee931d9b..b1743da844 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,