>>> class A:
... pass
...
>>> A.__eq__ = lambda a, b: a == b
>>> A() == A()
Traceback (most recent call last):
File "<python-input-5>", line 1, in <module>
A() == A()
File "<python-input-4>", line 1, in <lambda>
A.__eq__ = lambda a, b: a == b
^^^^^^
File "<python-input-4>", line 1, in <lambda>
A.__eq__ = lambda a, b: a == b
^^^^^^
File "<python-input-4>", line 1, in <lambda>
A.__eq__ = lambda a, b: a == b
^^^^^^
[Previous line repeated 988 more times]
RecursionError: maximum recursion depth exceeded
>>> import operator
>>> A.__eq__ = operator.eq
>>> A() == A()
Traceback (most recent call last):
File "<python-input-8>", line 1, in <module>
A() == A()
TypeError: eq expected 2 arguments, got 1
If you run with
previewset, then the FURB118 check makes an unsafe replacement, you can see me rolling back the change wntrblm/nox@a91dbe2 to make the tests pass, the difference in behavior can be shown with this MWE: