с1 = С()
с2 = С()
print c1.atrib, с2.atrib
c1.atrib = 5
print c1.atrib, с2.atrib
class C(object):
atrib = 0
c1 = C()
c2 = C()
print c1.atrib, c2.atrib # 0 0
C.atrib = 5
print c1.atrib, c2.atrib # 5 5
class Class(object):
def some_value():
doc = "The some_value property."
def fget(self):
return self._some_value
def fset(self, value):
self._some_value = value
def fdel(self):
del self._some_value
return locals()
some_value = property(**some_value())
Class.some_value = 5
first = Class()
second = Class()
print Class.some_value
print first.some_value
print second.some_value