docstr func __doc__ ' amdocstr func __doc__docstr spam __doc__ ' amspam __doc__ or docstr spam __doc__ or self __doc__docstr spam method __doc__ ' amspam method __doc__ or self method __doc__x docstr spam( method( amspam __doc__ or docstr spam __doc__ or self __doc__ amspam method __doc__ or self method __doc__ discussion of the pydoc toolwhich knows how to format all these strings in reports and web pagesappears in here it is running its help function on our code under python (python shows additional attributes inherited from the implied object superclass in the new-style class model--run this on your own to see the extrasand watch for more about this difference in )help(docstrhelp on module docstrname docstr amdocstr __doc__ file :\code\docstr py classes spam class spam amspam __doc__ or docstr spam __doc__ or self __doc__ methods defined heremethod(selfi amspam method __doc__ or self method __doc__ functions func(argsi amdocstr func __doc__ documentation strings are available at runtimebut they are less flexible syntactically than commentswhich can appear anywhere in program both forms are useful toolsand any program documentation is good (as long as it' accurateof course!as stated beforethe python "best practicerule of thumb is to use docstrings for functional documentation (what your objects doand hash-mark comments for more micro-level documentation (how arcane bits of code workdocumentation strings revisited