Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Annotations for __eq__ #12

Closed
JelleZijlstra opened this issue Nov 23, 2023 · 1 comment
Closed

Annotations for __eq__ #12

JelleZijlstra opened this issue Nov 23, 2023 · 1 comment
Labels
wait-for-council Issues that should not be addressed until the Typing Council exists

Comments

@JelleZijlstra
Copy link
Owner

The spec should say something about how __eq__ methods should be written and annotated.

A few considerations:

  • Enable type checkers to warn on non-overlapping equality comparisons. The type annotations should ideally allow type checkers to look at a check like A() == B() and verify whether it can ever return True.
  • Some level of support for __eq__ returning a non-boolean (classic example: numpy arrays)
  • How to think about __eq__ methods that return NotImplemented on unrecognized types versus those that throw an error
@JelleZijlstra JelleZijlstra added the wait-for-council Issues that should not be addressed until the Typing Council exists label Nov 23, 2023
@JelleZijlstra
Copy link
Owner Author

python/typing#1536

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wait-for-council Issues that should not be addressed until the Typing Council exists
Projects
None yet
Development

No branches or pull requests

1 participant