Reply to Paul Moore:

if some_condition:
    constant a = 1
else:
    a = 2
a = 3

Yes this is allowed. This is runtime.

for i in range(10):
    constant a = []

Not sure. Though it's preferable to be runtime. Preferable is "not allowed".

And lists are also literals. Any Python Object that is not assigned to a 
variable is a literal. Python claims that itself. A preview -

[10] = [2]
SyntaxError: Can't assign to literal here.

Constants should have a similar error -

constant x = 10
x = [2]
SomeErrorType: Can't assign to constant here.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/4SOB5SQWPQVLSHLDNBZXO46Z2D7RUAGE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to