2 ms·
The list solves the problem because it is okay to mutate an object from an outer scope, whereas the += tries to assign a new value to the name. There are lots
by maxerickson 12y ago
The list solves the problem because it is okay to mutate an object from an outer scope, whereas the += tries to assign a new value to the name.
There are lots of other awful hacks:
def a2(start):
def a(v):
a.v+=v
return a.v
a.v=start
return a