[issue39111] Misleading documentation for NotImplemented

2019-12-27 Thread Terry J. Reedy
Change by Terry J. Reedy : -- versions: -Python 3.5, Python 3.6 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue39111] Misleading documentation for NotImplemented

2019-12-24 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue39111] Misleading documentation for NotImplemented

2019-12-20 Thread Steven D'Aprano
Change by Steven D'Aprano : -- title: Misleading documentation -> Misleading documentation for NotImplemented ___ Python tracker ___

[issue39111] Misleading documentation

2019-12-20 Thread Steven D'Aprano
Steven D'Aprano added the comment: The behaviour is correct: `==` should not raise, even if both objects' `__eq__` method returns NotImplemented. I agree that the documentation needs improvement. Looking at the current version:

[issue39111] Misleading documentation

2019-12-20 Thread Murali Ganapathy
Murali Ganapathy added the comment: === # python3 class Base: def __eq__(self, other): print("base called") return super().__eq__(other) class Foo(Base): def __eq__(self, other): print("foo called") return NotImplemented Foo() == Foo() # foo called # foo called False

[issue39111] Misleading documentation

2019-12-20 Thread Brett Cannon
Brett Cannon added the comment: And to be more specific, == is guaranteed to work by falling back to object.__eq__() which falls back to object identity if the object doesn't have a custom __eq__() method. -- ___ Python tracker

[issue39111] Misleading documentation

2019-12-20 Thread Brett Cannon
Brett Cannon added the comment: This is because your class implicitly inherits from object and object.__eq__() is implemented and does not return NotImplemented. -- nosy: +brett.cannon resolution: -> not a bug stage: -> resolved status: open -> closed

[issue39111] Misleading documentation

2019-12-20 Thread Murali Ganapathy
New submission from Murali Ganapathy : The documentation at https://docs.python.org/3.6/library/constants.html#NotImplemented states If all attempts return NotImplemented, the interpreter will raise an appropriate exception. However this is not true for __eq__. === class Foo: def