3 ms·
I've never thought of this as a footgun. It's useful to accumulate state in a function, sort of like a static variable in c. E.g., def func(x=[]): x.a
by patrick451 5y ago
I've never thought of this as a footgun. It's useful to accumulate state in a function, sort of like a static variable in c. E.g.,
def func(x=[]):
x.append(5)
return x
I've always been annoyed that pylint yells at you for this.
- ViViDboarder 5y agoThe issue is that it’s a non-apparent side effect to an outside caller.