I am having a small code that define a class with one property. Then when I expect in the main program for the prints, they don't happen and the result for the above code is '5':
class C:
def __init__(self):
self._x = None
@property
def x(self):
print 'getter'
return self._x
@x.setter
def x(self, x):
print 'setter'
self._x = x
def main():
C.x = 5
print C.x
if __name__ == '__main__':
main()
My question is what can I do to make this code print the 'getter' and the 'setter'?