def get_method_sig(method):
    """ Given a function, it returns a string that pretty much looks how the
    function signature_ would be written in python.

    :param method: a python method
    :return: A string similar describing the pythong method signature_.
    eg: "my_method(first_argArg, second_arg=42, third_arg='something')"
    """

    # The return value of ArgSpec is a bit weird, as the list of arguments and
    # list of defaults are returned in separate array.
    # eg: ArgSpec(args=['first_arg', 'second_arg', 'third_arg'],
    # varargs=None, keywords=None, defaults=(42, 'something'))
    argspec = inspect.getargspec(method)
    arg_index=0
    args = []

    # Use the args and defaults array returned by argspec and find out
    # which arguments has default
    for arg in argspec.args:
        default_arg = _get_default_arg(argspec.args, argspec.defaults, arg_index)
        if default_arg.has_default:
            args.append("%s=%s" % (arg, default_arg.default_value))
        else:
            args.append(arg)
        arg_index += 1
    return "%s(%s)" % (method.__name__, ", ".join(args))
def get_method_sig ( method ) : argspec = inspect . getargspec ( method ) arg_index = 0 args = [ ] for arg in argspec . args : default_arg = _get_default_arg ( argspec . args , argspec . defaults , arg_index ) if default_arg . has_default : args . append ( "%s=%s" % ( arg , default_arg . default_value ) ) else : args . append ( arg ) arg_index += 1 return "%s(%s)" % ( method . __name__ , ", " . join ( args ) )
Given a function, it returns a string that pretty much looks how the
    function signature_ would be written in python.

    :param method: a python method
    :return: A string similar describing the pythong method signature_.
    eg: "my_method(first_argArg, second_arg=42, third_arg='something')"