[Python-3000] Status of True, False, bool type
Mike Orr
sluggoster at gmail.com
Tue Jan 2 07:29:25 CET 2007
On 1/1/07, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> "Mike Orr" <sluggoster at gmail.com> wrote:
> > Huh? 'True == 1' is a "feature"? '16 + (0 == 0)' being illegal is a
> > "Javaism"? Would somebody care to explain this? It's acceptable that
> > 2 is true but not True? Why do we need 1 for True at all if we have
> > True?
>
> >>> 1 is not True
> True
> >>> 1 == True
> True
> >>> isinstance(True, int)
> True
>
> If you are suggesting that we change this behavior, stop, it is not
> going to happen. If you are asking why this is the case, I would imagine,
> is based in C/C++/many other sane and insane languages' handling of
> boolean true.
It doesn't matter to me if it stays. I thought 1 meaning True was
just a concession to backward compatibility because Python didn't have
True and False from the beginning. So this would be a good time to
ditch it. Having 1 mean two different things means you can't tell
immediately whether a variable is numeric or boolean; e.g., is it a
line count or just a statement that some lines exist? Fortunately I
rarely see Python code nowadays that uses 1 this way.
--
Mike Orr <sluggoster at gmail.com>
More information about the Python-3000
mailing list