Non should behave as closely as possible to it not being defined at all. So return NotImplemented.
On Sun, May 1, 2022 at 09:53 Patrick Reader <_...@pxeger.com> wrote: > On 01/05/2022 06:20, Serhiy Storchaka wrote: > > The question is how to interpret value None: > > > > * Always raise TypeError (with changed message)? This is what happen > > currently when you set the method to None, this is the most compatible > > option. > > * Always raise an error, but allow to change it to more appropriate > > type (for example AttributeError for __setattr__)? > > * Interpret value None the same way as an absent attribute? > What about binary operators (__add__, __eq__, etc)? Should they act as > if they'd returned NotImplemented? Or immediately unconditionally raise > a TypeError? > _______________________________________________ > 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/PLWKIT7FWXLKIGQXL3X5GFT3MGTC53R3/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido (mobile)
_______________________________________________ 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/JNFF5Q6M2AU2YKZP52XTAL6HHDMGFRV7/ Code of Conduct: http://python.org/psf/codeofconduct/