PEP 285: Adding a bool type

Erik Max Francis max at alcyone.com
Tue Apr 2 17:37:42 EST 2002


Alex Martelli wrote:

> The Language Reference manual of the Python language disagrees
> with you.  E.g. at
> http://www.python.org/dev/doc/devel/ref/Booleans.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.
> """

Note that's not complete; it doesn't mention instances of custom classes
which override the __nonzero__ method to return one of these types.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Nationalism is an infantile sickness.
\__/ Albert Einstein
    Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
 A new, virtual planet, every day.



More information about the Python-list mailing list