Код: Выделить всё
def myfunc(x):
y = x
y.append(' appendix') # change happens here
return y
x = []
z = myfunc(x)
print(x) # change is reflected here, and appendix is printed
Подробнее здесь: https://stackoverflow.com/questions/317 ... -parameter
Код: Выделить всё
def myfunc(x):
y = x
y.append(' appendix') # change happens here
return y
x = []
z = myfunc(x)
print(x) # change is reflected here, and appendix is printed