3 ms·
Now I'm curious. What would you say is wrong with python closures? Asking because they feel natural to me, and I haven't run into anything irritating about th
by MereInterest 10y ago
Now I'm curious. What would you say is wrong with python closures? Asking because they feel natural to me, and I haven't run into anything irritating about them. (As opposed to lambdas, which are really annoying and restricted in Python.)
- qwertyuiop924 10y agoIt's not as bad as I thought, but Python doesn't actually have lexical scope, not really. But the LEGB rules mean that it should still work as you expect.
- TJSomething 10y agoIt does if you're using Python 3, which has the nonlocal keyword for lexical scope.
- qwertyuiop924 10y agoFinally. But that should really be default.