Hacker News new | ask | show | jobs
by jimbokun 5438 days ago
"but Python supports proper closures"

Is this a recent development? Without proper lexical scoping, don't you have to do weird stuff like creating an array if you want to update a value inside a "closure"?

1 comments

One might argue you shouldn't mix functional programming with side effects. ;P

But it's not so much the case of scoping as the case of variable binding. Assignments/statements in Python don't work like they do in some other languages. So your inner function can reference the outer "x" all it wants, but you'll get problems if you try to do something like x += 1.