On 2021-08-24 17:55, Patrick Reader wrote:
On 24/08/2021 06:27, Steven D'Aprano wrote:
Wouldn't that attempt to resolve global y, rather than local y? Unless
there is a change to the current behaviour of the compiler, I think you need to fool the compiler:

       if False: y = 0  # anywhere inside the function is okay
Time to add a `nonnonlocal` statement ;)

Or perhaps use "not nonlocal"? :-)
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/USZ5FOQ6WF365VC7C4ZH4K4TR5AW2X2Q/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to