[Tutor] Quacks like an object

Christopher King g.nius.ck at gmail.com
Tue Oct 25 01:02:28 CEST 2011

Dear Tutors,
    I am trying to make an object, which will appear exactly like an object
of my choice. It will should be impossible to tell it is not the object.
This is because I am making an object that modifies it methods so that if
the methods make a change to the object, it will sync those changes to a
file, but I don't want it to be another object, so foreign functions will
not mistake for not being the object. For example
if, I used type on the object, it should return the class of the object it
is trying to mimic. I have tried everything from modifying the object's get
set attribute methods, to having making a new object that has get and set
the same as the object except with a filter for methods, but I had no luck.
In a nutshell, I want an object that walks like another object, quacks like
another object, and basically is another object. Is this possible?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111024/562305e7/attachment-0001.html>

More information about the Tutor mailing list