From 003be529323a395be4a17c779aff7e4737170bbf Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 3 May 2011 11:01:32 -0700 Subject: Fix __hash__ in functools.cmp_to_key() to work with collections.Hashable. --- Lib/functools.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'Lib/functools.py') diff --git a/Lib/functools.py b/Lib/functools.py index e92a2fcd68..90642a58b2 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -111,8 +111,7 @@ def cmp_to_key(mycmp): return mycmp(self.obj, other.obj) >= 0 def __ne__(self, other): return mycmp(self.obj, other.obj) != 0 - def __hash__(self): - raise TypeError('hash not implemented') + __hash__ = None return K _CacheInfo = namedtuple("CacheInfo", "hits misses maxsize currsize") -- cgit v1.2.1