[Python-ideas] Should Python have user-defined constants?
Greg Ewing
greg.ewing at canterbury.ac.nz
Tue Nov 21 16:49:32 EST 2017
Steven D'Aprano wrote:
>>for i in range(0, 100):
>> const foo = f(i)
>> const bar = g(i, foo)
>> do_something_with(bar)
>
> You are binding some value f(0) to the
> constant name "foo" on the first loop, then on the second loop you try
> to rebind a new value to the same name "foo".
It could be made to kind of work if you were allowed to
re-execute the same let statement, but not assign to the
name with another statement in the same function.
--
Greg
More information about the Python-ideas
mailing list