我稍微这个程序的输出困惑:理解实例变量
class Test(object):
a = None
b = None
def __init__(self, a):
print self.a
self.a = a
self._x = 123;
self.__y = 123;
b = 'meow'
输出以下行有什么让我困惑:
instance = Test(3) #Output is None
print Test.a #Output is None
print instance.a #Output is 3. Why does this print 3?
我跟为什么print Instance.a
挣扎打印3和其他两行不。
感谢