getting argument names from a function
mail at fredriks.org
Tue Jul 10 18:41:40 CEST 2001
On Tue, 10 Jul 2001, dan wrote:
> def aFunction(arg1, arg2):
> print arg1, arg2
> is there a way I can get to the arguments of aFunction (i.e. 'arg1' and
> I've tried dir(..) on the function object and subsequent object and can't
> find what I'm looking for. Is it possible to do what I want?
If the function has a func_code object you can try this approach,
I have never use it myself and there probably is better ways.
Use Ctrl-D (i.e. EOF) to exit.
>>> def foo(bar,bar2):
... print "foobar"
I think this will only work for functions written in python, and not
extensions written in C (atleast thats what my brain thinks).
More information about the Python-list