Dennis Lee Bieber <[email protected]> writes:
>> (Python does not have anything that one might consider a true constant
>> -- other than the language defined singletons: None, and maybe by now
>> True and False).
> Python now deals with those by making the names keywords::
>
> >>> True = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
> >>> False = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
> >>> None = object()
> File "<stdin>", line 1
> SyntaxError: can't assign to keyword
>
> which seems to rather avoid the question of whether they are “constants”
> as would be understood by newcomers experienced with that term in other
> languages.
>
This is true for Python 3, but the OP wrote his program in Python 2. In
Python 2, you can do this (unfortunately):
>>> True, False = False, True
>>> if False:
... print("DOH!")
...
DOH!
--
https://mail.python.org/mailman/listinfo/python-list