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

    def f(id):
        c = ClassA(id)
        ...
        return ...
        
    def g(id):
        c = ClassB(id)
        ...
        return ...    

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.

    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 ...

I'm pretty sure this is possible, but did not find how...
How can I give a class as argument to a Python function
===

I have two functions in my (first!) Python program that only differ by the class that must be instanciated.

    def f(id):
        c = ClassA(id)
        ...
        return ...
        
    def g(id):
        c = ClassB(id)
        ...
        return ...    

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.

    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 ...

I'm pretty sure this is possible, but did not find how...