Howto get the argument defaults of a function using an AST-object?

Fredrik Lundh fredrik at pythonware.com
Tue Jul 4 07:29:09 EDT 2006


stefan at mayr-stefan.de wrote:

> I can only get a list with the arguments or the defaults. The following
> examples would return the same:
>
> def foo(x, y=True)
> def foo(x=True, y)

the latter is a syntax error.

> Anyone an idea?

the defaults array contains the defaults for the len(defaults) last arguments.

</F> 






More information about the Python-list mailing list