From: Matej C. <mc...@re...> - 2008-03-14 12:05:09
|
On 2008-03-13, 06:21 GMT, Heshan Suriyaarachchi wrote: > Is there something like reflection in python which could help > me in this process. If someone can direct me to a code sample > , I will be grateful. There is module inspect, but I haven't felt the need to use it so far, because a) you can do dir(module) or dir(module.object) to get a list of all available methods, properties, objects, etc. try dir() and import sys dir(sys) or f=file("somefilename") dir(f) b) well written libraries have docstrings and then you can do print object.__doc__ which should give you some information about the object. And of course all pydocs are available with pydoc, which can be conveniently run as a webserver pydoc -p 8888 makes a webserver on http://localhost:8888 with all available documentation. Matěj |