Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> nonlocal

Oh please, no. This is probably the worst feature of Python.



I'd love to improve this, but without knowing what makes it a misfeature in Python I don't have any guidance.

Maybe the choice of keyword is bad because of the association but it's also not quite the same as in Python. You don't have to "nonlocal x" up front in your function to access a nonlocal variable, which is a pretty huge difference IMO.

My purpose for "nonlocal" was to have a visual highlight of whenever a nonlocal variable is getting modified, because that's the exact point where assignment becomes a side-effect. So you only ever use it when assigning.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: