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 ;) _______________________________________________ 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/WMUK3XLP4GOR25ELCF3LUTAWT6YIPDSI/ Code of Conduct: http://python.org/psf/codeofconduct/
- [Python-Dev] Re: PEP 667: Consistent views of na... Mark Shannon
- [Python-Dev] Re: PEP 667: Consistent views o... Guido van Rossum
- [Python-Dev] Re: PEP 667: Consistent vie... Mark Shannon
- [Python-Dev] Re: PEP 667: Consisten... Guido van Rossum
- [Python-Dev] Re: PEP 667: Consi... Gregory P. Smith
- [Python-Dev] Re: PEP 667: Consi... Nick Coghlan
- [Python-Dev] Re: PEP 667: Consi... Guido van Rossum
- [Python-Dev] Re: PEP 667: Consistent views of namesp... Steven D'Aprano
- [Python-Dev] Re: PEP 667: Consistent views of na... Guido van Rossum
- [Python-Dev] Re: PEP 667: Consistent views of namespaces Steven D'Aprano
- [Python-Dev] Re: PEP 667: Consistent views of namesp... Patrick Reader