, , , , init , , , . , , .
, : Python. Python. :
a = [1,2,3]
b = a
You do not set bto a value a. You set bto reference the same object. So the statement:
a is b
It is true because the names refer to the same object.
a = [1,2,3]
b = [1,2,3]
a is b
This will return false. The reason is that now you have created two different objects. So the line:
self.argument = argument[:]
is a (necessary) way to make a copy self.argumentso that it does not refer to the same object.
source
share