PEP 285: Adding a bool type
Erik Max Francis
max at alcyone.com
Fri Apr 5 16:53:12 EST 2002
Steve Holden wrote:
> *My* point, however badly I originally made it, was that writing
>
> if ret == None:
>
> is *sometimes* like writing
>
> if (a == 3) == True:
>
> assuming this new wart appears in Python.
Comparing to None (preferably via is rather than ==, since == can be
overridden to do strange things) is perfectly legitimate when an API
declares that a function or method returns "an object or None." After
all, the __nonzero__ method can be overridden to make perfectly valid
objects evaluate to false in a truth test.
--
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