Guido van Rossum wrote:
> Looks like NotImplemented is widely misunderstood. It should ONLY be
> returned from binary operator overloads, like __add__.
> On Wed, Mar 11, 2020 at 03:49 jdve...@gmail.com
> wrote:
> > Steven D'Aprano wrote:
> > On Wed, Mar 11, 2020 at 09:42:15AM -0000, Steve
> > Jorgensen wrote:
> > I realize this is probably something that would
> > be
> > hard to change for
> > compatibility reasons. Maybe someone can think of a way around that
> > though?
> > It seems to me that not NotImplemented should result in
> > NotImplemented and attempting to convert it to bool should raise
> > a
> > TypeError exception.
> > To my disappointment, you will get your wish, at least for the second
> > part:
> > https://bugs.python.org/issue35712
> > I am disappointed because, to me, it is a fundamental part of Python's
> > object model that everything can be interpreted as a truthy/falsey
> > object (in the absence of bugs).
> > Anyway, the deprecation warning has been checked in, so it's probably
> > only a matter of time before you will get your TypeError :-)
> > Oouh, I also feel disappointed. Indeed, I feel that NotImplemented is a
> > fiasco and that a TypeError exception should be raised instead. But I
> > suppose it is central to duck typing concept...
> > 
> > Python-ideas mailing list -- python-ideas@python.org
> > To unsubscribe send an email to python-ideas-le...@python.org
> > https://mail.python.org/mailman3/lists/python-ideas.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-ideas@python.org/message/7VCQ6M...
> > Code of Conduct: http://python.org/psf/codeofconduct/
> > -- 
> > --Guido (mobile)
> >

Widely misunderstood and little known. But documentation is very clear if read 
carefully. Even an example is provided. 

However, it is a special case and special cases, you know, are... special. They 
can be difficult to understand by non-advanced users --like me.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/IX7H5RTJE2NPLPVTAJPRBUKNCVVNHZXV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to