def get_Callable_args_res ( clb ) : try : return clb . __args__ , clb . __result__ except AttributeError : # Python 3.6 return clb . __args__ [ : - 1 ] , clb . __args__ [ - 1 ]
python get args for a called function
Python version independent function to obtain the parameters of a typing . Callable object . Returns as tuple : args result . Tested with CPython 2 . 7 3 . 5 3 . 6 and Jython 2 . 7 . 1 .
def get_Callable_args_res(clb):
    """Python version independent function to obtain the parameters
    of a typing.Callable object. Returns as tuple: args, result.
    Tested with CPython 2.7, 3.5, 3.6 and Jython 2.7.1.
    """
    try:
        return clb.__args__, clb.__result__
    except AttributeError:
        # Python 3.6
        return clb.__args__[:-1], clb.__args__[-1]