这是怎么回事???
class Person(object):
name = 'abc'
obj1 = Person()
obj2 = Person()
obj1.name = 'world'
print obj1.name # world
print obj2.name # abc
Person.name = 'hello'
print obj1.name # world
print obj2.name # hello
class Person(object):
name = 'abc'
obj1 = Person()
obj2 = Person()
obj1.name = 'world'
print obj1.name # world
print obj2.name # abc
Person.name = 'hello'
print obj1.name # world
print obj2.name # hello
2015-04-30
举报