adding methods on the fly

Renzo Tomaselli renzo.tomaselli at tecnotp.it
Fri Jul 5 12:14:07 EDT 2002


Hi all,
    after a long and unsuccessful search about extending C++ classes by
Python methods, I came up to the point where a couple of basic questions
should be answered:

1. Can we add new (Python) methods to a C object wrapper, e.g. after it has
been instantiated with a normal (C) method table ?
2. if not: can we add a new method to an already imported Python class ? If
yes, how can we do it, assuming to start from a method statement hosted by a
string ?

I understand that the latest version (2.2.1) allows for defining a class
which inherits from a C type, so that we can define some Python methods on
it, while retaining the capability of inherited C methods.
The point is that I want to add Python methods on demand to such class.
Thanks,

Renzo Tomaselli





More information about the Python-list mailing list