How to overwrite __getattribute__() in Python
<p>I am trying to modify <code>__getattribute__()</code> method for an instance, as you may already know, <code>__getattirbute__</code> is read-only attribute in Python (edit: appereantly, for some objects it is, and for others it isn't). What I have in mind is, create a new object like this:</p>

<pre><code>def create_new_instace(old_instance):
    class temp(old_instance.__class__):
        def __init__(self,*args,**kwargs):
            "Since we will copy an already inited instance"
            pass
        def __getattribute__(self,attr):
           # do stuff
    new_instance = temp()
    # magically copy all attrs of old_instance to new_instance
    return new_instance
</code></pre>

<p>Is this kind of thing possible? I am not having a particular problem, I just want to know how to do this.</p>
