Imagine, there is a function like this
def bar(a: str, b: str):
"""
Do somehting with a and b.
"""
print(a, b)
Then there is a class, where i would like to adapt this function, but keep the docstring (and also the dynamic autocomplete and help) of the original function.
class Foo:
def foo(self, **kwargs):
bar(a=kwargs.get("a"), b=kwargs.get("b"))
print("This was called fro the class method")
How do i dynamically link the original function to the class, including docstrings? And are kwargs the best way to pass the arguments, without repeating them in the definition of the class-method?
So when i type Foo.foo()
in my IDE or jupyter notebook, i would like to see the docstring of foo().