[Tutor] Central Python Library / Viewing __doc__ strings

Patrick K. O'Brien pobrien@orbtech.com
Sun, 10 Jun 2001 10:16:21 -0500


You are most welcome. If you are interested, here is the latest version of
my startup file (.pythonrc.py):

from pydoc import help
from pprint import pprint

def doc(x):
    """Print type, representation and documentation string for object x."""
    print "Object:", str(x)
    print "Object Type:", type(x)
    print "Representation:", repr(x)
    print "Documentation String:"
    print "---------------------"
    try:
        print x.__doc__
    except AttributeError:
        print "This object does not have a documentation string."

# Let the user know that this file has been loaded by their IDE.
# If it doesn't get loaded they won't see the following message.
import os
print "---"
print "Python Startup file (%s) was loaded." %
os.environ.get('PYTHONSTARTUP')
print "---"
del os

---
Patrick K. O'Brien
Orbtech
"I am, therefore I think."

-----Original Message-----
From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
Allan Crooks
Sent: Sunday, June 10, 2001 9:29 AM
To: tutor@python.org
Subject: [Tutor] Central Python Library / Viewing __doc__ strings

Hi,

First off, thanks to everyone who responded to my message. Needless to say,
I feel somewhat stupid for not trying print. :)

Thanks for the scripts people sent as well. I'm growing somewhat fond of
Patrick's however, so I'll probably use that over Pydoc's. Thanks very much
Patrick. :)