NotImplemented is like a pure virtual function; failing to implement it
tells you that you forgot part of the contract, except at runtime instead
of compile time. So if you never need them, you're free to elide them, but
if you want full compatibility, you need to implement every part of it.

If someone tried to Obj + Obj and that's just completely nonsensical for
the type, then NotImplemented is a reasonable message, as opposed to
NameError which can be rather confusing. Alternately, you can implement it
and tell the caller exactly why it's not implemented. It's also useful for
anyone looking to subclass by immediately showing them every base method
they might need to implement.

-Em
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/VPARRUAONYWMKELECKVAC4HP7AI23W2W/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to