|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-11-13 23:06:43
----- Original Message -----
From: "Ivan A. Vigasin" <vig_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, November 13, 2001 7:39 PM
Subject: Re: [boost] Multiple inheritance & constructors problem.
Boost.python
> On Tue, 13 Nov 2001, David Abrahams wrote:
>
> Dave,
>
> Many thanks for your answer !
>
>
> One of solutions is to wrap each extension class with real python class.
>
> Can you offer more elegant solution?
Ivan,
I think I have your answer:
class MyClass(ExtClass, Thread):
__Thread_init = Thread.__init__
def __init__(self):
ExtClass.__init__(self)
self.__Thread_init()
From what I can see in the source code, this should work.
As in fact it does (!):
# comprehensive is an extension module
>>> class Base:
... def __init__(self):
... self.x = 'hello'
...
>>> class MyClass(comprehensive.A1,Base):
... __init_Base_ = Base.__init__
... def __init__(self):
... comprehensive.A1.__init__(self)
... self.__init_Base_()
>>> c = MyClass()
>>> dir(c)
['_MyClass__init_Base_', '__doc__', '__init__', '__module__', 'inheritA1',
'overrideA1', 'x']
>>> c.x
'hello'
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk