True inconsistency in Python

Ron Adam radam2 at tampabay.rr.com
Tue Nov 18 02:34:41 EST 2003


On Mon, 17 Nov 2003 23:40:52 -0500, "Terry Reedy" <tjreedy at udel.edu>
wrote:

>
>"Ron Adam" <radam2 at tampabay.rr.com> wrote in message
>news:8qhirvgi2sf5l3vkfocq65mcb94c6pbb9s at 4ax.com...
>> No, this one point is not the only reason,  I made the example a
>> little farfetched to demonstrate a concept I think is a valid reason
>> to have 'True' and 'False' as Constants.
>
>The developers agree and would make them so now if it were not for
>backward compatibility needs.  They probably will make them so in the
>future.  Currently, reassigning None can get you a Warning.

That would be good.


>> Their actual internal
>> values shouldn't be relevant or depended on.
>
>When the bool type was added, a few people argued for a pure bool type
>with no relation to anything else.  However, in Python, 'practicality
>beats purity'.  Having True/False == 1/0 now and forever has practical
>uses.

Good also.

>> In python you can change the value of True, or set True to point to
>> something different.
>
>Yes, you are currently allowed to stab yourself in the back (but even
>this will probably change in the future).  Don't do it.
>
I agree,  it's good that it may change.

>> For example you can do this.
>> >>> True = False
>> Now all bets are off....
>
>Ditto.
>
>> To be sure that True is True and False is
>> False,  we need to put in explicit definitions into our programs.
>
>In 2.2.2+, you only need to not change them and to not work with a
>psycopath.

Many people are starting to learn programming with python as their
first computer language.   I wouldn't refer to them as a psychopath.
They may one day write programs that save peoples lives.  They have to
start someplace.   Many people using python will not be professional
programmers but enthusiast and hobbiests,  or web page programmers,
or .....   in other words, a very large and diverse group. 

>...
>> The above is much less implausible.  Do you agree?
>
>Yes, it is more plausible that you shoot yourself in the feet than
>that Guido and the whole Python development community go bonkers.  I
>strongly suspect that PyChecker can check for assignments to True and
>False (along with about a hundred other things).  Get it and use it.
>
>Terry J. Reedy
>

I'm not sure what your point is here,  but using PyChecker sounds like
a good suggestion.

_Ronald Adam






More information about the Python-list mailing list