Mix-In Class Methods At Run-Time

digitalorganics at gmail.com digitalorganics at gmail.com
Sat Jun 24 19:23:26 EDT 2006


Hi all. If I have an instance of class A, called say foo, and I need to
mix-in the functions and variables of another class (class B) to this
instance at runtime, how do I do it? In other words, I want to make foo
an instance of an anonymous and temporary class that inherits its
functionality from classes A and B, while at the same time I want the
pre-existing contents of foo to remain intact. Possible in Python?

Thanks....




More information about the Python-list mailing list