Annotations for __eq__
#1536
Labels
topic: documentation
Documentation-related issues and PRs
topic: typing spec
For improving the typing spec
It would be useful to have more guidance on how
__eq__
methods should be annotated.A few considerations:
A() == B()
and verify whether it can ever return True.__eq__
returning a non-boolean (classic example: numpy arrays)__eq__
methods that return NotImplemented on unrecognized types versus those that throw an errorSee also https://discuss.python.org/t/make-type-hints-for-eq-of-primitives-less-strict/34240
Covering this in the typing spec is important because it affects how library authors should annotate
__eq__
methods in their libraries if they want all type checkers to understand these methods.The text was updated successfully, but these errors were encountered: