[Q] Number of of arguments of a funcobject?

Thomas Schwaller (et@piranha.appl-math.tu-muenchen.de)
22 Aug 1994 16:18:38 GMT

I hope my question is not a FAQ, but looking at funcobject.c did not resolve the
following problem:

Suppose I want to write something like

static object* foo_create(object*, object* args)
{
object* function;
if (!getargs(args, "O", &function))
return NULL;
if (!is_funcobject(function)) {
err_setstr(TypeError, "function expected as argument");
return NULL;
}

..........

Now, I need the number of input and output arguments of function
eg. 2 and 3 for

def f(x,y):
return (x-y,x,y);

How can I get them in my C code? I tried it with "getfuncargstuff" but this didn't
work. Can somebody help me?

Tom

Python! The best thing since Tk!

-- 

Thomas Schwaller Institute for Applied Mathematics Technical University Munich Dachauerst. 9A D-80335 Munich Germany

et@appl-math.tu-muenchen.de