[Python-Dev] ACCEPTED: PEP 285
Andrew Koenig
ark at research.att.com
Wed Apr 3 23:16:16 EST 2002
Neal> This code:
Neal> True = 1
Neal> False = 0
Neal> def test(a):
Neal> if a is True: print 'True'
Neal> if a == False: print 'False'
Neal> generates these warnings:
Neal> test.py:2: Should not assign to True, it is (or will be) a builtin
Neal> test.py:3: Should not assign to False, it is (or will be) a builtin
Neal> test.py:6: Comparisions with True are not necessary
Neal> test.py:7: Comparisions with False are not necessary
I'd like to suggest that comparisons with True are not only
unnecessary but dangerous. Comparisons with False are much
less dangerous but still unnecessary.
--
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark
More information about the Python-list
mailing list