56-python-类和对象命名空间
class Foo:
count = 0
def __init__(self):
Foo.count += 1
a = Foo()
b = Foo()
print(a.count) # 打印结果:2
print(b.count) # 打印结果:2
class Foo:
count = 0
def __init__(self):
Foo.count += 1
a = Foo()
b = Foo()
print(a.count) # 打印结果:2
print(b.count) # 打印结果:2