代码版本3.6.3 文档版本:3.6.6
object.
__hash__
(self)Called by built-in function
hash()
and for operations on members of hashed collections includingset
,frozenset
, anddict
.
__hash__()方法会被上述四种情况调用。
If a class does not define an
__eq__()
method it should not define a__hash__()
operation either; if it defines__eq__()
but not__hash__()
, its instances will not be usable as items in hashable collections. If a class defin