Extending a black box python module
<p>I have a "blackbox" python module which I would like to extend. The module provides a class <code>class Foo</code> with no <code>__init__</code> function, and a helper function <code>FooMaker</code> which returns objects of type <code>Foo</code>. The usual strategy of extending modules:</p>

<pre><code>class ExtendedFoo(blackbox.Foo):
    def __init__(self, x):
        super(ExtendedFoo, self).__init__(x)
</code></pre>

<p>would not work here, since, as mentioned above I need to rely on <code>blackbox.FooMaker</code> instead of <code>Foo</code>'s <code>__init__</code> function.</p>

<p>Any ideas on how to extend the module <code>blackbox</code>?</p>

<p>It turned out that the <code>Foo</code> class had a setter function, so what eventually worked for me was</p>

<pre><code>class ExtendedFoo(blackbox.Foo):
    pass

def ExtendedFooMaker(*args):
    _efoo = ExtendedFoo()
    _efoo.set(FooMaker(*args).get())
    return _efoo
</code></pre>

python python-2.7 cython