On 30/11/2022 20:27, Anony Mous wrote:
Danceswithmice wrote:



The idea is that YOU write "local:", and the interpreter, without you ever seeing it, promotes that into a hidden function with a hidden name and a hidden call.

---

p.f.moore wrote:

> That would make "return" in the local scope exit the scope, not the
enclosing function. Which is almost certainly not what people would expect
from a "local scope" statement.

Hence my remark about return and yield requiring attention. These would be disallowed in the context of "local:" UNLESS there is an enclosing scope of "def function():", so there's no issue of what they do if they are simply mainlined, and (I think) a well defined result if they are not.

What about getting an untrapped exception? Again, your suggestion would mean that only the local scope is exited.  Again, this would be unexpected.
Best wishes
Rob Cliffe

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

Reply via email to