Chris Angelico wrote:
# Python def outer(): x = 0 def inner(): nonlocal x x += 2
Is it better to say "nonlocal" on everything you use than to say "self.x" on each use?
I've not used Python closures since nonlocal came about, but AFAIK you only need to use nonlocal if there's an assignment to the variable in the scope. Maybe an augmented assignment creates the same constraint but logically it shouldn't.