How can I use descriptors for non-static methods?
<p>I am aware that I can use descriptors to change static property as if it were a normal property. However, when I try using descriptors for a normal class property, I end up changing the object it references to, instead of the value in the object.</p>

<p>If I have</p>

<p>Normal use, considering that the method(param) returns an object</p>

<pre><code>class SomeClass():
    property = method(param)
</code></pre>

<p>I can then do:</p>

<pre><code>instance = SomeClass()
instance.property = 3
</code></pre>

<p>and be able to have that setting handled by the the class of which property is an instance.</p>

<p>Now, if I instead have</p>

<pre><code>class SomeClass():
    def__init__(self):
        self.property = method(param)
</code></pre>

<p>and I do:</p>

<pre><code>instance = SomeClass()
instance.property = 3
</code></pre>

<p>That code does not work, and I overwrite the reference to the object created by method(param) with 3, instead of having that setting handled by the descriptor.</p>

<p>Is there a way I can use descriptors without static methods? In essence, I need to be able to create several instances of the class, each with its own unique properties that can be altered using the convenient descriptor method. Is that possible?</p>

<p>Python version: 2.7</p>

<p>Thanks!</p>

<p>guys,</p>

<p>Thanks for the help. Out of many great suggestions, I decided to wrap the <strong>set</strong> and <strong>get</strong> methods, thus losing the practicality of descriptors, while keeping the practicality of having a module completely programmed for me. I simply extended the class "PageElement" and created two new methods get() and set(), which call their correspondent implementations:</p>

<pre><code>def get(self):
    return self.__get__(self.owner_page, self.owner_page.__class__)

def set(self, value):
    self.__set__(self.owner_page, value) 
</code></pre>

<p>Thanks for the help! I opened up my eyes to a lot of details in the language that I still do not know. And I will keep digging.</p>

python python-2.7