ACCEPTED: PEP 285
Delaney, Timothy
tdelaney at avaya.com
Thu Apr 4 19:13:06 EST 2002
> From: Terry Reedy [mailto:tejarex at yahoo.com]
>
> > Clarification
> >
> > This PEP does *not* change the fact that almost all object types
> > can be used as truth values. For example, when used in an if
> > statement, an empty list is false and a non-empty one is true;
> > this does not change and there is no plan to ever change this.
>
> almost? all? I am under the impression that 'if x:' is universally
> valid, and consider that one of the good features of Python's prime
> dichotomy system.
Something of the form:
class Klass:
def __nonzero__(self):
raise NotImplementedError
will fail an if x: test ...
Tim Delaney
More information about the Python-list
mailing list