Any way to get information from fun objects about their parameters?
amy-g-art at cox.net
Thu Mar 25 02:23:22 CET 2004
"Amy G" <amy-g-art at cox.net> wrote in message
news:rqq8c.41431$Bg.29453 at fed1read03...
> "Kenneth McDonald" <kmmcdonald at wisc.edu> wrote in message
> news:slrnc64bcn.2qa.kmmcdonald at g4.gateway.2wire.net...
> > For autodocumentation purposes, I'd like to be able to load a module
> > and then find out the following information about functions and
> > methods defined within it:
> > 1) Parameter names and order
> > 2) Default value, if any, associated with each parameter
> > 3) If the *param or **param conventions are used in the
> > parameter list.
> I had thought of writing a mod for this kind of info too, but all I really
> needed was what help(<modname>) output. However, it would me nice to have
> this functionality.
> > Reading documentation about function objects, the only
> > relevant information I can extract is a tuple representing
> > default param values, which is not useful to me.
> > I know I could probably do this by parsing the module, but
> > I would strongly prefer a simpler way.
> You could parse the output of help(<modname>). That would probably be
> easier than parsing the module itself.
This won't return their order however. It is listed alphabetically.
> > I'd have thought that,
> > like docstrings and many other properties, the parameter info
> > would also be stored with function objects.
> As far as I know this info is not strored.
More information about the Python-list