[Python-Dev] ACCEPTED: PEP 285

Gustavo Niemeyer niemeyer at conectiva.com
Sun Apr 7 05:34:58 EDT 2002


> >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.
> 
> It is neither worse nor better than using '==', IMO. Yes, it is a
> singleton, but the danger is using 'a is True' instead of simply 'a'.

It *is* worse. "a is True" works as expected, while "a == True" doesn't.
If the programmer doesn't know what "is" means, that's another story,
and then the warning should be "read the manuals, please". When PyChecker
becomes so pedantic to warn about everything a programmer that doesn't know
the language at all could be doing wrong, I'll stop using it.

-- 
Gustavo Niemeyer

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





More information about the Python-list mailing list