names of parameters as string

Richie Hindle richie at
Fri Oct 29 18:18:48 CEST 2004

> I'd like to access the parameter list of a function

You can do it like this:

>>> def foo(foo_param1, foo_param2):
...   foo_local = foo_param1
>>> code = foo.func_code
>>> print code.co_varnames[:code.co_argcount]
('foo_param1', 'foo_param2')

Richie Hindle
richie at

More information about the Python-list mailing list