[issue35712] Make NotImplemented unusable in boolean context

Terry J. Reedy report at bugs.python.org
Fri Jan 11 16:49:59 EST 2019


Terry J. Reedy <tjreedy at udel.edu> added the comment:

I consider it a nice feature of Python that all builtin objects, and, AFAIK (and Josh, apparently), all stdlib class instances, have a boolean value.  (I am aware of numpy's element-wise behavior.)  I hate to give this up.  This is part of Python's general avoidance of singular exceptions and exceptions to exceptions.  This proposal would be the latter: "An object is truthy, unless its class makes it false, unless it is NotImplemented and a TypeError."

If this exception is made, I expect that there will be proposals to extend the exception to other objects, such as Ellipsis.

----------
nosy: +terry.reedy
stage:  -> test needed
type: behavior -> enhancement
versions: +Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35712>
_______________________________________


More information about the Python-bugs-list mailing list