Dynamically adding @property in python
<p>I know that I can dynamically add an instance method to an object by doing something like:</p>

<pre><code>import types
def my_method(self):
    # logic of method
# ...
# instance is some instance of some class
instance.my_method = types.MethodType(my_method, instance)
</code></pre>

<p>Later on I can call <code>instance.my_method()</code> and self will be bound correctly and everything works.</p>

<p>Now, my question: how to do the exact same thing to obtain the behavior that decorating the new method with @property would give?</p>

<p>I would guess something like:</p>

<pre><code>instance.my_method = types.MethodType(my_method, instance)
instance.my_method = property(instance.my_method)
</code></pre>

<p>But, doing that <code>instance.my_method</code> returns a property object.</p>
