Built-in Constants

NotImplemented — operator negotiation sentinel

Return NotImplemented from a binary special method when its implementation cannot handle the given operand combination. Python may try another implementation, including a reflected method; a right operand of a strict subclass can receive priority. When arithmetic or ordering has no successful implementation, Python raises TypeError; equality and inequality can instead fall back to identity. Calling a special method directly does not trigger operator negotiation. NotImplemented is neither a false result nor NotImplementedError, which is an exception. Test it with is, not bool(): truth testing emits DeprecationWarning in Python 3.13 and raises TypeError in Python 3.14. Its built-in name can be shadowed, so avoid reusing it for other purposes.

Formal Syntax & Structure

python syntaxpython
NotImplemented

Return Value

NotImplementedType

The singleton used to decline an unsupported binary operation.

Working Example

Example Snippetpython
class Left:    def __add__(self, other):        return NotImplemented
class Right:    def __radd__(self, other):        return "reflected result"
print(Left().__add__(Right()) is NotImplemented)print(Left() + Right())try:    Left() + object()except TypeError:    print("unsupported")
Python Reference