diff options
| author | Jens W. Klein <jk@kleinundpartner.at> | 2020-02-16 18:09:08 +0100 |
|---|---|---|
| committer | Jens W. Klein <jk@kleinundpartner.at> | 2020-02-16 18:13:44 +0100 |
| commit | 70952aca35d7021dcce34149f38672aadd577f70 (patch) | |
| tree | 376164084c63849a72f7fe3f289cd8c25a6acda7 /src | |
| parent | 7f6f60e824ac34e2bf9ec890e6c361f57bfc823b (diff) | |
| download | zope-interface-use-object-hash.tar.gz | |
Fixes #178: performace improvement by using objects hashuse-object-hash
Diffstat (limited to 'src')
| -rw-r--r-- | src/zope/interface/interface.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py index ade6f42..2e7d76f 100644 --- a/src/zope/interface/interface.py +++ b/src/zope/interface/interface.py @@ -596,12 +596,9 @@ class InterfaceClass(Element, InterfaceBase, Specification): # This spelling works under Python3, which doesn't have cmp(). return (n1 > n2) - (n1 < n2) - def __hash__(self): - try: - return self._v_cached_hash - except AttributeError: - self._v_cached_hash = hash((self.__name__, self.__module__)) - return self._v_cached_hash + # use the very fast object hash function, no need for custom impl + # see https://github.com/zopefoundation/zope.interface/issues/178 + __hash__ = object.__hash__ def __eq__(self, other): c = self.__cmp(other) |
