How can i get the parameternames of a non documented function ?

mzo hilfmir at gmx.at
Tue Feb 24 02:40:47 EST 2004


"Robert Brewer" <fumanchu at amor.org> wrote in message news:<mailman.216.1077557899.27104.python-list at python.org>...
> Martin wrote:
> > I import a module (wrapped from c code) and have no documentation of
> > it. How can i find out the name of the parameters / head of the
> > functions ?
> 
> An example:
> 
> >>> import parser
> >>> dir(parser)
> ['ASTType', 'ParserError', 'STType', '  copyright  ', '  doc  ',
> '  file  ', '  name  ', '  version  ', ' pickler', 'ast2list',
> 'ast2tuple', 'compileast', 'compilest', 'expr', 'isexpr', 'issuite',
> 'sequence2ast', 'sequence2st', 'st2list', 'st2tuple', 'suite',
> 'tuple2ast', 'tuple2st']
> 
> 
> Robert Brewer
> MIS
> Amor Ministries
> fumanchu at amor.org

dir() return an alphabetized list of names comprising (some of) the
attributes
of the given object, and of attributes reachable from it. It does not
return the parameter for a function.

Example: 

>>> dir(parser.ast2list)
['__call__', '__class__', '__cmp__', '__delattr__', '__doc__',
'__getattribute__
', '__hash__', '__init__', '__module__', '__name__', '__new__',
'__reduce__', '_
_reduce_ex__', '__repr__', '__self__', '__setattr__', '__str__']
>>> help(parser.ast2list)
Help on built-in function ast2list:

ast2list(...)
    Creates a list-tree representation of an ST.
>>>
Help return (...) instead parameter - why ?? 


In Python manual: 
st2list(ast[, line_info])

How can i get (ast[, line_info]) without manual ? 

martin



More information about the Python-list mailing list