Empty lists, tuples, dicts as defaults on functions and methods declarations are prone to changing their default values if the variable in the argument is changed throughout the function/method scope.
What is the expected result?
No response
What is the actual result?
No response
Steps/Code to reproduce
def fn(x=[]):
x.append(1)
return x
print(fn())
print(fn([2,3]))
print(fn())
Short description
Empty lists, tuples, dicts as defaults on functions and methods declarations are prone to changing their default values if the variable in the argument is changed throughout the function/method scope.
What is the expected result?
No response
What is the actual result?
No response
Steps/Code to reproduce
Tracebacks (optional)
No response
Environment details (optional)
No response
Would you like to work on this issue?
Yes