For this to work as you expect, Test
needs to be a new-style class:
class Test(object):
^^^^^^^^
This is hinted at in the documentation for property()
:
Return a property attribute for new-style classes (classes that derive from
object
).
When I turn Test
into a new-style class, and attempt to change prop
, I get an exception:
In [28]: t.prop='Re-Init'
AttributeError: can't set attribute