AdamElKaroui
AdamElKaroui

Reputation: 81

Show arguments of a function

I want to see the arguments of a function in a specific library, example:

import lib

Let's say that lib contains a function func with two arguments: size and date. I want to find a function help such that when I do something like help(lib.func), it gives me something like TWO ARGUMENTS: size and date.

Any suggestions?

Upvotes: 0

Views: 58

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599490

You need inspect.getfullargspec.

Get the names and default values of a Python function’s parameters. A named tuple is returned:

FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)

Upvotes: 4

Related Questions