[Python-Dev] ACCEPTED: PEP 285
Wed, 03 Apr 2002 18:13:29 -0500
Guido van Rossum wrote:
> Despite the negative feedback, I've decided to accept the PEP. The
> most important perceived problem is that newbies tend to write
> if x == True: ...
> where they should write
> if x: ...
> I believe this problem should be solved by education (the Zen master
> hits the student on the head with a stick, and the student gets
> enlightenment) rather than by holding back what I believe will be a
> useful feature. You can expect the bool type in Python 2.3; it will
> be in CVS tonight.
And the warnings have already been added to pychecker.
I know I'm going to wish I never said this, but ...
If you find REAL problems with code that breaks, let me know.
I will try to address problems that may arise.
True = 1
False = 0
if a is True: print 'True'
if a == False: print 'False'
generates these warnings:
test.py:2: Should not assign to True, it is (or will be) a builtin
test.py:3: Should not assign to False, it is (or will be) a builtin
test.py:6: Comparisions with True are not necessary
test.py:7: Comparisions with False are not necessary