I am trying to modify __getattribute__() method for an instance, as you may
already know,__getattirbute__ is read-only attribute in Python. What I have
in mind is, create a new object like this:
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
Is this kind of thing possible?
--
http://yasar.serveblog.net/
--
http://mail.python.org/mailman/listinfo/python-list