On Mon, Aug 17, 2009 at 7:03 PM, Julien Le Dem
> Is there a way to get the function signature from a PyFunction object ?
> I would like to know the number of parameters a function takes and their
Two slightly icky ways I know (both implemented deep in the bowls of
1) eval "inspect.formatargspec(*inspect.getargspec(myfunction))" and parse
the string that you get. This gets you keyword and variable arguments and
2) crash right through the API:
int argCount = ((PyTableCode) myfunction.func_code).co_argcount;
String v = ((PyTableCode) myfunction.func_code).co_varnames;
Then stare at PyBaseCode.call to see if you can figure out all the corner
cases. We use '1' in the case of CodeFlag.CO_VARARGS or CO_VARKEYWORDS or
I would be happy to hear other ideas, but this code is working fine for us.