[Techtalk] Python doc strings

Dan Richter daniel.richter at wimba.com
Mon Apr 26 18:27:35 EST 2004


> help(object) will read them:

Wow, I didn't know about the help() function! Thanks!

I personally have learned a lot about Python functions by reading the 
__doc__ strings manually, together with using the dir() function.

Including a __doc__ string accomplishes the same thing as putting a 
description in comments at the top of the class/function, but has the 
added benefit that the documentation can be accessed from the Python 
command-line (as I did it) or by help() (which is nicer to use), or by 
any program that uses your class/function.

-- 
    I'm actually hoping that [Linux] won't take more than 25 or 30%
    of the market. If Linux owned 95% of the market it would be
    ... as sick [as Windows]. There is some need for competition.
                - Linus Torvalds



More information about the Techtalk mailing list