How can I give a class as argument to a Python function
<p>I have two functions in my (first!) Python program that only differ by the class that must be instanciated.</p>

<pre><code>def f(id):
    c = ClassA(id)
    ...
    return ...

def g(id):
    c = ClassB(id)
    ...
    return ...    
</code></pre>

<p>To avoid repeated code, I would like to be able to write a single function that would somehow accept the class to instanciate as a parameter.</p>

<pre><code>def f(id):
    return f_helper(id, ... ClassA ...)

def g(id):
    return f_helper(id, ... ClassB ...)

def f_helper(id, the_class):
    c = ... the_class ... (id)
    ...
    return ...
</code></pre>

<p>I'm pretty sure this is possible, but did not find how...</p>
