ACCEPTED: PEP 285
John Roth
johnroth at ameritech.net
Sat Apr 6 20:44:07 EST 2002
"djw" <dwelch91 at nospam.attbi.com> wrote in message
news:3CABB156.1010401 at nospam.attbi.com...
> Pardon my ignorance (I've only been working with Python for a short
> while), but I don't understand why an idiom like:
>
> if x == True:
>
> would be/should be an error (or warning initially). I see C/C++ code
> like this all the time:
>
> bool x;
> x = Foo(Bar);
> if (x==true)
> {...
Guido explains this in the latest version of the PEP. As I understand
it, if
True compared True to anything except the standard False
things (zero, empty sequences, etc.) then you could get
relationships like
6 == True == 7.
Since equality is transitive, this leads to the inescapable
conclusion that 6 == 7.
John Roth
More information about the Python-list
mailing list