__doc__ in interactive mode

rihad rihad at mail.ru
Wed Jan 16 11:54:35 CET 2002


Hi there, I tried to follow GvR's advice for newbies to use the form
modname.funcname.__doc__ in case we're not sure how something works.

>>> print atexit.register.__doc__
register a function to be executed upon normal program termination

    func - function to be called at exit
    targs - optional arguments to pass to func
    kargs - optional keyword arguments to pass to func

>>> `atexit.register.__doc__`
"'register a function to be executed upon normal program
termination\\n\\n    fu
nc - function to be called at exit\\n    targs - optional arguments to
pass to f
unc\\n    kargs - optional keyword arguments to pass to func\\n    '"


How come? Doesn't print use repr() (same as ``) for its output?
Other forms (atexit.register.__doc__, str(atexit.register.__doc__))
only differ by the number of backslashes (\n instead of \\n etc)




More information about the Python-list mailing list