hello
>>> import random
>>> print random.setstate.__doc__
Restore internal state from object returned by getstate().
my question is
" how can i loop through all the methods in a module
and print out their '__doc__' content ?
>>> for d in dir( random ):
print random.???d???.__doc__
The prior responses use dir(), requiring then the use of eval() to get the object.
You can get the name and object directly from random.__dict__. The following comprehension seems to handle all the stuff in random's dict:
methods = [name, str(object.__doc__)
for name, object in random.__dict__.iteritems()
if callable(object) and object.__doc__]
Then you can iterate over methods and format/print as desired.
mailto:[EMAIL PROTECTED]
510 558 3275 home
720 938 2625 cell
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor