[Python-Dev] ACCEPTED: PEP 285

Gustavo Niemeyer niemeyer@conectiva.com
Thu, 4 Apr 2002 01:42:55 -0300

Hi Neal!

> 	    if a is True: print 'True'
> 	test.py:6: Comparisions with True are not necessary

Testing if "a is True" is ok. True and False are singletons
this is the best way to know if 'a' is really 'True' (and not 1,
[0], "foo", etc). This test will be necessary sometimes.

> 	    if a == False: print 'False'
> 	test.py:7: Comparisions with False are not necessary

This should probably say something more agressive, like
"Comparisions with boolean values may be dangerous", since this
may give undesirable results (if the user was trying to check
for False, and not for 0, [], "", etc).

Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]