getting argument names from a function

Mike C. Fletcher mcfletch at home.com
Wed Jul 11 02:10:00 EDT 2001


In case anyone else is doing help-function kind of stuff, also note the
standard pydoc module, which provides a "help" function that extracts all
this info and formats it into text or HTML for you.  Can be used
interactively or to generate static documentation.

Enjoy,
Mike

PS: for an example of static documents:
http://pyopengl.sourceforge.net/documentation/pydoc/OpenGLContext.html

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Travis Oliphant
Sent: July 10, 2001 19:00
To: python-list at python.org
Subject: Re: getting argument names from a function
...

In Python 2.1 the inspect module provides easy access to the introspection
facilities of Python.

>> apply(inspect.formatargspec, inspect.getargspec(aFunction))

will return

aFunction(arg1, arg2)

I just found this facility myself and am using it to add a simple help
command to SciPy (www.scipy.org)
...





More information about the Python-list mailing list