3 ms·
Oh, yes. You are mutating variables. You shouldn't do that anyway in a functional setting. Python's syntax forces the language to guess whether you want to m
by eru 17y ago
Oh, yes. You are mutating variables. You shouldn't do that anyway in a functional setting.
Python's syntax forces the language to guess whether you want to make a new variable or use the variable of the same name from the outer scope. The heuristic they have, says that if you assign something to the variable, you get a new one by default. You can declare
global x
before to assign to the variable in the outerscope.