3 ms·
Ah, this is like closures or decorators in python.
by stuaxo 11y ago
Ah, this is like closures or decorators in python.
- junke 11y agoThose are closures (btw, did you mean generators instead of decorators?). Until nonlocal (https://www.python.org/dev/peps/pep-3104/ https://www.python.org/dev/peps/pep-3104/), python closures were limited (http://stackoverflow.com/questions/141642/what-limitations-have-closures-in-python-compared-to-language-x-closures http://stackoverflow.com/questions/141642/what-limitations-h...). Even though nonlocal solves the problems, the resulting scoping rules are messy: global, local, nonlocal, ...