[docs] [issue37934] Docs: Clarify NotImplemented use cases

Vedran Čačić report at bugs.python.org
Mon Sep 2 10:24:34 EDT 2019


Vedran Čačić <vedgar at gmail.com> added the comment:

Sorry, I think you still don't understand.

The emulation of double dispatch by single dispatch, with all complications it brings, is the only reason NotImplemented exists. If Python didn't have binary operators (or inheritance), I'm quite sure it wouldn't have NotImplemented. The idea was never "oh, this method isn't supported", but much more precise "this half of protocol, with given ordering of operands according to a class hierarchy, isn't implemented - try the other half".

Of course, you might argue that _once Python has NotImplemented_, it can be used elsewhere - but as I said, I don't think it should be encouraged.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37934>
_______________________________________


More information about the docs mailing list