Comparison with False - something I don't understand

Harishankar v.harishankar at gmail.com
Thu Dec 2 09:18:25 EST 2010


On Thu, 02 Dec 2010 02:49:50 -0800, Stephen Hansen wrote:
>...
>...
>...
> * P.S. I'm not saying its never right to use "is" outside of The
> Singletons. Just that its probably not, for most people, what they
> actually should do in most code. There are numerous counter-examples, of
> course. Its just a general guideline to follow. Until a need arises that
> demonstrates otherwise.

Here I'm using it to compare the result of a function where I 
specifically return False on error condition, so I think it's better I 
check it against the literal False rather than the fuzzy False produced 
by the boolean operation.

I wouldn't do this in most situations though, but I did need to 
distinguish between the the empty list and False and using the broader 
form as in "if not a" did not work as expected.

-- 
Harishankar (http://harishankar.org http://lawstudentscommunity.com)




More information about the Python-list mailing list