experiment: remove `__eq__` from `object` by randolf-scholz · Pull Request #16348 · python/typeshed · GitHub
Skip to content

experiment: remove __eq__ from object - #16348

Draft
randolf-scholz wants to merge 2 commits into
python:mainfrom
randolf-scholz:eq_experiment
Draft

experiment: remove __eq__ from object#16348
randolf-scholz wants to merge 2 commits into
python:mainfrom
randolf-scholz:eq_experiment

Conversation

@randolf-scholz

Copy link
Copy Markdown
Contributor

A more drastic approach to address #15345, just to see what would happen...

@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

@randolf-scholz

Copy link
Copy Markdown
Contributor Author

The error messages mypy produces like

+ pylint/config/arguments_manager.py:385: error: Unsupported operand types for == ("int" and "str")  [operator]

are misleading. Most of these operator errors should actually be lints indicating redundant comparison. We statically know a comparison of int and str is always going to be False.

python's operator systems uses expections as values via NotImplemented. Nevertheless, the way the python interpreter handles a == b is different to how it handles, say a+b because it will always default to False if both type(a).__eq__(a, b) and type(b).__eq__(b, a) return NotImplemented.

@AlexWaygood

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants