typing
typing copied to clipboard
[spec] Document `NotImplemented` special casing?
Type checkers and typeshed special case NotImplemented to be treated as Any, this appears to be not documented in the spec currently.
A small paragraph should probably go here: https://typing.python.org/en/latest/spec/special-types.html
I am not aware of a case where treating NotImplemented as Any is really useful, and recently opened python/mypy#20114 to remove this special casing from Mypy. An idea is to use NotImplemented / NotImplementedType to specify the behaviour of binary operators as discussed in #1548.