You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the documentation, which I think explains all this clearly: briefly, return NotImplemented and raise NotImplementedError are the normal usages. raise NotImplemented doesn't make sense, and shouldn't be used: it'll end up raising a TypeError, sine NotImplemented is neither a subclass nor an instance of BaseException.
Almost all of the grep results you're seeing do follow the expected patterns (either return NotImplemented or raise NotImplementedError, but a quick grep does show some questionable uses of raise NotImplemented in the standard library:
MacBook-Pro:cpython mdickinson$ grep -r . -e raise --include=\*.py | grep "\bNotImplemented\b"
./Lib/asyncio/transports.py: The implementation here raises NotImplemented for every method
./Lib/idlelib/debugger_r.py: raise NotImplemented("dict_keys not public or pickleable")
./Lib/ssl.py: raise NotImplemented("Can't dup() %s instances" %
The other way around also turns up an odd-looking return NotImplementedError (along with a false positive):
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: