[issue37934] Docs: Clarify NotImplemented use cases

Jeroen Demeyer report at bugs.python.org
Wed Sep 4 15:03:26 EDT 2019


Jeroen Demeyer <jeroen.k.demeyer at gmail.com> added the comment:

> As you say, we currently have only one usage of NotImplemented outside its intended purpose.

I know at least 3 in CPython, so it's not so rare to use NotImplemented for something else than binary operators:
1. __subclasshook__
2. reducer_override (in pickling)
3. __length_hint__

> 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.

I'm not saying that it should be actively encouraged, but the documentation shouldn't be limited to just one use case. Given that NotImplemented exists, why shouldn't it be used in more cases to indicate that an operation is not implemented?

----------

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


More information about the Python-bugs-list mailing list