[issue30026] Hashable doesn't check for __eq__

2017-04-09 Thread Raymond Hettinger
Raymond Hettinger added the comment: > # Can't instantiate abstract class X with abstract methods Sorry, this is how ABCs are supposed to work. They use @abstractmethod to specify requirements that a subclass if required to implement. The ABC metaclass then enforces that requirement, prevent

[issue30026] Hashable doesn't check for __eq__

2017-04-09 Thread Max
Max added the comment: Sorry, this should be just a documentation issue. I just realized that __eq__ = None isn't correct anyway, so instead we should just document that Hashable cannot check for __eq__ and that explicitly deriving from Hashable suppresses hashability. -- components:

[issue30026] Hashable doesn't check for __eq__

2017-04-09 Thread Max
New submission from Max: I think collections.abc.Hashable.__subclasshook__ should check __eq__ method in addition to __hash__ method. This helps detect classes that are unhashable due to: to __eq__ = None Of course, it still cannot detect: def __eq__: return NotImplemented but it's better t