[Python-ideas] Programming recommendations (PEP 8) and boolean values

Michael Foord fuzzyman at gmail.com
Thu Aug 9 00:04:22 CEST 2012


On 8 August 2012 17:59, Oleg Broytman <phd at phdru.name> wrote:

> On Thu, Aug 09, 2012 at 02:18:53AM +1000, Ben Finney <
> ben+python at benfinney.id.au> wrote:
> > What is a compelling use case for checking precisely for True or False?
>
>    To distinguish False and None for a tri-state variable that can have
> 3 values - "yes", "no" and "unspecified" - True, False and None in
> Python-speak.
>
>
Or when testing, I often want to check that a method *really* returns True
or False rather than some object that happens to evaluate to True or False.

Michael


> Oleg.
> --
>      Oleg Broytman            http://phdru.name/            phd at phdru.name
>            Programmers don't die, they just GOSUB without RETURN.
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 

http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120808/f4fa66d6/attachment.html>


More information about the Python-ideas mailing list