-
由 Radostin Stoyanov 提交于
Lists in Python are mutable and when used as a default value of a parameter for class constructor, its value will be shared between all class instances. Example: class Test: def __init__(self, mylist=[]): self.mylist = mylist A = Test() B = Test() A.mylist.append("mylist from instance A") print(B.mylist) # Will print ['mylist from instance A'] Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com> Signed-off-by: NRadostin Stoyanov <rstoyanov1@gmail.com>
94f417ba