On 1/1/07, Josiah Carlson <[EMAIL PROTECTED]> wrote: > > "Mike Orr" <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
