Changing truth
Martin v. Löwis
martin at v.loewis.de
Thu Jan 16 07:25:21 EST 2003
Christian Tismer <tismer at tismer.com> writes:
> What I think is that None, False and True have the
> drawback that they are names, which can be changed.
> I would like to make them like literals.
> Nobody can try to write
>
> 1 = 42
Python 2.3a1 (#38, Jan 16 2003, 11:55:00)
[GCC 3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def foo(None):pass
...
<stdin>:1: SyntaxWarning: argument named None
>>> None=1
<stdin>:1: SyntaxWarning: assigment to None
Assignment to None will be disallowed in a future release. True and
False would have been banned in the same way as well, if testing
hadn't found that quite a lot of code has constants named True and
False already. As this code gets modified to use the builtin
constants, SyntaxWarnings, then Errors, can be added for these as
well.
Regards,
Martin
More information about the Python-list
mailing list