12.07.2015 Views

Is Python a

Is Python a

Is Python a

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

too). Enter the name of a module you’re interested in, and press the Enter key;PyDoc will march down your module import search path (sys.path) looking for referencesto the requested module.Figure 14-1. The Pydoc top-level search engine GUI: type a name of a module you wantdocumentation for, press Enter, select the module, and then press “go to selected” (or use nomodule name, and press “open browser” to see all available modules).Once you’ve found a promising entry, select it, and click “go to selected.” PyDoc willspawn a web browser on your machine to display the report rendered in HTML format.Figure 14-2 shows the information PyDoc displays for the built-in glob module.Notice the hyperlinks in the Modules section of this page—you can click these tojump to the PyDoc pages for related (imported) modules. For larger pages, PyDocalso generates hyperlinks to sections within the page.Like the help function interface, the GUI interface works on user-defined modules aswell. Figure 14-3 shows the page generated for our docstrings.py module file.PyDoc can be customized and launched in various ways we won’t cover here; see itsentry in <strong>Python</strong>’s standard library manual for more details. The main thing to takeaway from this section is that PyDoc essentially gives you implementation reports“for free”—if you are good about using docstrings in your files, PyDoc does all thework of collecting and formatting them for display. PyDoc only helps for objects likefunctions and modules, but it provides an easy way to access a middle level of documentationfor such tools—its reports are more useful than raw attribute lists, andless exhaustive than the standard manuals.286 | Chapter 14: The Documentation Interlude

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!