[Tutor] getting __doc__ strings

Eric Black ericblack69@yahoo.com
Fri Nov 29 15:40:01 2002


Hi Listers,
   I'm a newbie at this, but here's a scrap 
of code I'm kind of proud of. It's a fast, 
handy way to get quick, concise documentation 
on a lot of cogs in Python.  
   The only thing is that when I apply it to 
my own modules it doesn't just get the modules 
docstrings but every thing the module has 
imported. As they say that's too much information.

## a = (__builtins__) # or a = () or {} or 
## set a to an instance of any builtin type
## or to a module such as os or sys.
## Will print all of the attribute docstrings
## of any given type.

def doc(a):
    
    for eachAttribute in dir(a):
        print '***' + eachAttribute + '***'
        e = 'a.' + eachAttribute + '.__doc__'
        print eval( e )
        print

   Hope someone can use this.
        Regards
        Eric

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com