I have really strange problem. Here is the sample code:
class SomeClass(object):
a = []
b = []
def __init__(self, *args, **kwargs):
self.a =
Because self.a and self.b are actually references to the same list object.
If you want to modify one without changing the other, try this
class SomeClass(object):
# a = []
# b = [] # these two class member not necessary in this code
def __init__(self, *args, **kwargs):
self.a = [(1,2), (3,4)]
self.b = list(self.a) # copy to a new list
self.a.append((5,6))
print self.b
SomeClass()