PEP 285: Adding a bool type: yes, but not as int subtype

Tim Peters tim.one at comcast.net
Mon Apr 1 15:00:51 EST 2002


[Kris J. Zaragoza]
> I have to ask one question that I haven't seen brought up yet: What
> does PEP 285 imply for the future of Python?  Do you intend to
> eventually change the concept of what is true?
>
> Specifically, I refer to the Python Language Reference
> (http://www.python.org/doc/2.2/ref/lambda.html):
>
> """In the context of Boolean operations, and also when expressions are
> used by control flow statements, the following values are interpreted
> as false: None, numeric zero of all types, empty sequences (strings,
> tuples and lists), and empty mappings (dictionaries). All other values
> are interpreted as true."""

I'll channel him:  he intends to add False to that list.  That's all.

> ...
> If you don't intend to modify this concept, then what's the real gain
> for the new boolean type?

Have you read the PEP?  I can assure you he's not hiding a killer good
reason he hasn't already mentioned <wink>.

> ...
> (Try explaining to a newbie that it's actually one of two
> pre-allocated instances!)

Why would a newbie need to know that?  They seem to get along fine without
realizing that None is the unique instance of NoneType, and, unlike as for
None, it should be rare to see code relying on unique object identity for
True and False.





More information about the Python-list mailing list