Re: [Tutor] all methods in a module

2005-05-27 Thread Kent Johnson
Bob Gailer wrote: >> 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 ob

Re: [Tutor] all methods in a module

2005-05-27 Thread Bob Gailer
At 04:46 AM 5/27/2005, Johan Meskens CS3 jmcs3 wrote: 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

Re: [Tutor] all methods in a module

2005-05-27 Thread Wolfram Kraus
Johan Meskens CS3 jmcs3 wrote: > 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 ? > > fo

Re: [Tutor] all methods in a module

2005-05-27 Thread Johan Meskens CS3 jmcs3
Johan Meskens CS3 jmcs3 wrote: > 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

Re: [Tutor] all methods in a module

2005-05-27 Thread Ewald Ertl
Hi! I've the following solution: >>> for d in [ "random." + d for d in dir(random)]: ... if callable( eval(d) ): ... print "%30s :\n\n %s" % ( d, eval( "%s.__doc__" % ( d))) ... random.Random : Random number generator base class used by bound module function

Re: [Tutor] all methods in a module

2005-05-27 Thread Kent Johnson
Johan Meskens CS3 jmcs3 wrote: > 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__ print getattr(random, d).__doc__ in general you should be prepared

[Tutor] all methods in a module

2005-05-27 Thread Johan Meskens CS3 jmcs3
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_