modifying __class__

Piyush Jain piyush.subscription at gmail.com
Fri Oct 26 03:25:33 EDT 2007


Hi,
Itis possible to change the class of an object by assigning new value to
__class__
Is it possible to call my module when it is done.
For example,
object = ClassA()

object.__class__ = classB # I want to call my method when this statement is
executed.

I want to do it in a general way. For ex. , whenever __class__ is changed
for any object instance (of different classes), my own function is called.
How should I do it ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071026/4e6a9967/attachment.html>


More information about the Python-list mailing list