>>> def fun(l=[]):
... l.append(1)
... print(l)
...
>>> fun()
[1]
>>> fun()
[1, 1]
>>> fun([])
[1]
>>> fun()
[1, 1, 1]
>>>
The second output is as expected, explained by - "A new list is created once when the function is defined, and the same list is used in each successive call." (source: https://docs.python-guide.org/writing/gotchas/).
But when an empty list is explicitly passed as an argument, the function's list should be reset to [], and the last output should be [1, 1] instead of [1, 1, 1].