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? Unlessthere 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 okayTime to add a `nonnonlocal` statement ;)
Or perhaps use "not nonlocal"? :-) _______________________________________________ Python-Dev mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/USZ5FOQ6WF365VC7C4ZH4K4TR5AW2X2Q/ Code of Conduct: http://python.org/psf/codeofconduct/