class Func:
def __init__(self):
self.weight = 0
class Skill:
def __init__(self, bson):
self.f = [Func()]*5
for i in range(0,5):
self.f[i].weight = bson['w'+str(i+1)]
d = {"w1":20,"w2":0,"w3":0,"w4":0,"w5":0}
s = Skill(d)
print s.f[0].weight
The output is 0 rather than 20. I am always hard to figure out the difference of class member and object member in python.