1

I am working on python 3, with some methods that are nested. These shares keyword arguments something like below.

def fun_A(a, **kwargs):
    ...
    fun_B(**kwargs)
    ...

def fun_B(b, **kwargs):
    ...
    fun_C(c)
    ...

def fun_C(c=some_default_value):
    ...

With this code, when someone calls fun_A, 'b' and optionally, 'c' should be in kwargs. Also, calling fun_B requires optionally 'c' in kwargs.

The nested structure of sharing kwargs could be more complicated. I wonder if there are any automatic tools to give hints for kwargs, describing the arguments required and their default values in sub-methods.

eg.) When you see the docstring of fun_A, the tool may attach some information about kwargs, saying you need to specify b and optionally c and its default value is some_default_value.

Thank you.

0 Answers0