WmiClass: Don't share "versions" between instances
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>
Showing
想要评论请 注册 或 登录