Inherit function signature from another function

31 views Asked by At

In Python, is it possible to define a function without explicitly specifying the input arguments/types/default values, and inherit the signature from another function?

The goal being to still get PyCharm to know the correct signature and auto-complete/suggest correctly.

Sample code:

def generic_signature(arg1: bool = False, arg2: str = '42', arg3: dict = None, arg4: int = 42) -> dict[str, int]:
    pass

def my_function(...):  <--- Tell PyCharm to use the signature from generic_signature()
    pass

When I type my_function( in PyCharm, I want to see something like this: Expected PyCharm Output

0

There are 0 answers