[issue37110] Clarify hashability of custom class instances

2019-05-31 Thread Christoph Zwerschke
Christoph Zwerschke added the comment: My point was that it's not immediately obvious what "by default" means and that hashability is not only affected by the __hash__ method but also by __eq__. But I agree, you can argue that "by default" already includes not adding any special methods like

[issue37110] Clarify hashability of custom class instances

2019-05-31 Thread Raymond Hettinger
Raymond Hettinger added the comment: The docs look correct to me: >>> class A: pass >>> hash(A()) 274859987 User defined classes are in-fact hashable by default. Other methods can be defined to change hashability, but they are not the default. FWIW, it isn't the pu

[issue37110] Clarify hashability of custom class instances

2019-05-31 Thread Christoph Zwerschke
New submission from Christoph Zwerschke : The Python documentation says about hashability in the glossary (https://docs.python.org/3/glossary.html#term-hashable): "Objects which are instances of user-defined classes are hashable by default." This is not quite true. Objects of a user-defined c