On Jul 7, 9:11 am, George Sakkis <[EMAIL PROTECTED]> wrote: > On Jul 7, 9:31 am, "Adam C." <[EMAIL PROTECTED]> wrote: > > > > > We have a situation where we want a Swig-generated Python class to > > have a different base (not object). It doesn't appear that we can > > coerce Swig into generating the class we want at present (but we are > > still enquiring). > > > Is it possible to dynamically change the base class to something else? > > Initial experiments appear to show it is not: > > -------------------------------- snip -------------------------------->>> > > class Foo(object): > > > pass > > > >>> class Foozle(object): > > > pass > > > >>> Foozle.__bases__ = (Foo,) > > > Traceback (most recent call last): > > File "<pyshell#6>", line 1, in <module> > > Foozle.__bases__ = (Foo,) > > TypeError: __bases__ assignment: 'Foo' deallocator differs from > > 'object' > > -------------------------------- snip -------------------------------- > > > Is there a solution I am missing? > > > Thanks in advance. > > Supposedly it should (usually) work, there's a 6 year old patch for > this (http://bugs.python.org/issue635933). Check if Swig can generate > old-style classes (i.e. not inheriting from object) since __bases__ > assignment works for them. > > HTH, > George
Thanks. I think we would want new-style classes, and 6-year-old patches strike me as maybe a little out of the desired path... so this really just doesn't work in modern Python? -- http://mail.python.org/mailman/listinfo/python-list