Self descibing scripts
Neil Benn
neil.benn at cambridgeantibody.com
Sun Apr 1 10:30:05 EDT 2001
Hello,
Oooo, thanks Fredrik, that's close - the only problem is that it
doesn't return parameters required for the methods. D'ya know if it is
possible to do that?
Cheers,
Neil
"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:8b%x6.2720$sk3.877558 at newsb.telia.net...
> Neil Benn wrote:
>
> > I'm looking at a way to make pyhton scripts self describing.
> > I'm thinking of something similar to java's reflection.
> >
> > Has anyone tried this, I could code a list to be returned of the
> > functions in the script but that's a bit messy - any help/ideas would be
> > greatly appreciated!
>
> how about dir?
>
> >>> import math
> >>> dir(math)
> ['__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',
'cosh',
> 'e', 'exp', 'fabs', 'floor', 'fmod', 'frexp', 'hypot', 'ldexp', 'log',
'log10',
> 'modf', 'pi', 'pow', 'sin', 'sinh', 'sqrt', 'tan', 'tanh']
>
> Cheers /F
>
>
More information about the Python-list
mailing list