def add(x, items=[]):
items.append(x)
return items
print(add(1)) # Ожидается [1], получим [1]
print(add(2)) # Ожидается [2], получим [1, 2]... Почему?
def multiply(x, items=None):
if items is None:
items = []
items.append(x)
return items
print(multiply(1)) # Ожидается [1], получаем [1]
print(multiply(2)) # Ожидается [2], получаем [2], как и предполагается