[Python-Dev] Re: __dunder__ = None

2022-05-01 Thread Serhiy Storchaka
01.05.22 19:32, Guido van Rossum пише: Non should behave as closely as possible to it not being defined at all. So return NotImplemented. But, as was noted by Spencer Brown, it is not how it works for __iter__(), __reversed__() and __contains__() (which have a special path for producing expli

[Python-Dev] Re: __dunder__ = None

2022-05-01 Thread Guido van Rossum
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

[Python-Dev] Re: __dunder__ = None

2022-05-01 Thread Patrick Reader
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

[Python-Dev] Re: __dunder__ = None

2022-05-01 Thread Serhiy Storchaka
01.05.22 13:02, Spencer Brown пише: It actually is documented as being supported here: https://docs.python.org/3.10/reference/datamodel.html#id2 , and as mentioned there __iter__(), __reversed__() and __contains__() also have special s

[Python-Dev] Re: __dunder__ = None

2022-05-01 Thread Spencer Brown
It actually is documented as being supported here: https://docs.python.org/3.10/reference/datamodel.html#id2, and as mentioned there __iter__(), __reversed__() and __contains__() also have special support so they avoid trying to fallback to __getitem__ etc. Also some discussion at https://githu