[Python-ideas] Should Python have user-defined constants?

Clint Hepner clint.hepner at gmail.com
Tue Nov 21 06:08:50 EST 2017


> On Nov 21, 2017, at 5:40 AM, Stéfane Fermigier <sf at fermigier.com> wrote:
> 
> for i in range(0, 100):
>    const foo = f(i)
>    const bar = g(i, foo)
>    do_something_with(bar)

This wouldn’t work, since a for loop doesn’t introduce a new scope for variables, and allowing a constant to be rebound in the same scope would somewhat defeat the purpose.


More information about the Python-ideas mailing list