'Can't set attribute' with new-style properties in Python - Stack Overflow

Explore our sites Stack Overflow chat blog Meta Stack Overflow Careers 2.0 Stack Exchange sign up log in tour help careers 2.0 Stack Overflow Questions Tags Tour Users Ask Question Take the 2-minute tour × Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required. 'Can't set attribute' with new-style properties in Python up vote 24 down vote favorite 3 I'm trying to use new-style properties declaration: class C(object): def __init__(self): self._x = 0 @property def x(self): print 'getting' return self._x @x.setter def set_x(self, value): 'setting' self._x = value if __name__ == '__main__': c = C() print c.x c.x = 10 print c.x and ...

Linked on 2014-01-08 17:10:40 | Similar Links