Boost logo

Boost :

From: Ivan A. Vigasin (vig_at_[hidden])
Date: 2001-11-13 19:39:23

On Tue, 13 Nov 2001, David Abrahams wrote:


Many thanks for your answer !

> The best workaround I can think of is to derive A from an extension class.
> You could just wrap a boring empty struct.
A is not mine. I tried to subclass from extension class and threading.Thread at the same time.
class MyClass(ExtClass, Thread):

Of course, it's possible to derive from ExtClass only and create threads separately as

But it's not good, and situation is worse in case of other foreign classes (from standard library, for example).

One of solutions is to wrap each extension class with real python class.
Possibly like folowing:

class ExtWrapper(ExtClass):
  def __init__(self,real):
    self.real = real
  def EachMethod(self, *args):

class RealClass:
  def __init__(self):
    self.extclass = ExtWrapper(self)
  def EachMethod(self, args):

Can you offer more elegant solution?

Regards, Ivan <vig_at_[hidden]>
ICQ: 22181170

Boost list run by bdawes at, gregod at, cpdaniel at, john at