3 ms·
I guess this is confusing but i just think of it as capturing the reference to i, not the value of i. It would be nice if python had a nice way to deal with th
by dekhn 4y ago
I guess this is confusing but i just think of it as capturing the reference to i, not the value of i. It would be nice if python had a nice way to deal with this as many people also trip over:
def fun(initial_empty_list=[]):
where initial_empty_list is a reference captured at function definition time, not a new value initialized on each call to the function.