On Nov 27, 2007 6:47 AM, Sven Erik Knop <[EMAIL PROTECTED]> wrote: > Hi > > I am getting slightly frustrated and wonder if you can help me. > > Consider a Python class Foo implemented in C++. I have declared an > initialization method like this > > static int > Foo_init(P4Adapter *self, PyObject *args, PyObject *kwds) > { > > } > > and I am subclassing Foo in Python, which works fine in principle, > except for passing keywords. > > Here is the subclass: > > class Bar(Foo): > def __init__(self, *args, **kwlist): > Foo.__init__(self, args, kwlist) >
This passes the args tuple and the kw dict as 2 regular arguments. You need to expand them in the second call if you want them to be passed as args and kwargs - Foo.__init__(self, *args, **kwargs) -- http://mail.python.org/mailman/listinfo/python-list