On 1/12/22 6:58 am, Anony Mous wrote:
local:
     for MyVal in range(0,10)
         pass

provides scoping, making it easier for us to code, debug, and document, while significantly decreasing the likelihood of variable collisions.

I'm not convinced it would be beneficial in Python. In C
you have declarations that make it clear when you're
introducing a new variable, but in Python there's nothing
saying that MyVal has a restricted scope other than the
rather inconspicuous "local:" above it.

--
Greg
_______________________________________________
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/PCLKTM5FONDXGK3V6JS6EUX3JQ3FLDCP/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to