33 ms·
Nope, += also creates a binding! Try this: xs = [1, 2] def foo(): xs += [3] foo() You'll get an exception saying that local variable xs was u
by int_19h 5y ago
Nope, += also creates a binding! Try this:
xs = [1, 2]
def foo():
xs += [3]
foo()
You'll get an exception saying that local variable xs was used before it was assigned - precisely because += created a new local binding for xs inside foo.