ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-Tutor
python-Tutor
[Tutor] getting __doc__ strings
by Eric Black other posts by this author
Nov 29 2002 8:38PM messages near this date
Re: [Tutor] eval weirdness | Re: [Tutor] getting __doc__ strings
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

_______________________________________________
Tutor maillist  -  Tutor@[...].org
http://mail.python.org/mailman/listinfo/tutor
Thread:
Eric Black
Kalle Svensson

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved