
python – 类,dict,self,init,args?
class attrdict(dict): def __init__(self, *args, **kwargs): dict.__init__(self, *args, **kwargs) self.__dict__ = selfa = attrdict(x=1, y=2)print a.x, a.yb = attrdict()b.x, b.y

没有“self”的Python调用方法
所以我刚刚开始在 python编程,我不明白“自我”背后的整个推理.我知道它几乎像一个全局变量一样使用,这样可以在类中的不同方法之间传递数据.我不明白为什么在同一个类中调用另一个方法时需要使用它.如果我已经在上课了,为什么要告诉它? 例如,如果我有: 为什