예제 #1
0
파일: _frozenbidict.py 프로젝트: jab/bidict
 def __hash__(self) -> int:
     """The hash of this bidict as determined by its items."""
     if getattr(self, '_hash', None) is None:
         # The following is like hash(frozenset(self.items()))
         # but more memory efficient. See also: https://bugs.python.org/issue46684
         self._hash = t.ItemsView(self)._hash()  # type: ignore [attr-defined]  # https://github.com/python/typeshed/pull/7153
     return self._hash
예제 #2
0
 def __hash__(self) -> int:
     """The hash of this bidict as determined by its items."""
     if getattr(self, '_hash', None) is None:
         self._hash = _t.ItemsView(self)._hash()  # type: ignore
     return self._hash  # type: ignore