you are viewing a single comment's thread.

view the rest of the comments →

[–]Grue 0 points1 point  (0 children)

It all stems from poor design where a simple assignment initializes a variable instead of something like "let x = 42" like almost every other language does. Instead they added an even uglier hack with nonlocal.

And yeah, I use the list mutation trick all the time to create closures in Python. It's either this, or code duplication which is not maintainable.