the next is my code:
class a:
w={}
def __setattr__(self,name,value):
self.w[name]=value
def __getattr__(self,name):
return self.w[name]
b=a()
b.e='eee'
b['f']='fff'
print b.e,b['f'],b.w
#error
what is the difference between b.e and b[‘f’].
thanks
setitem/getitem is for indexed access (with square brackets) like shown above. setattr/getattr is for attribute access (i.e. mc.aa)