When writing a Perl module you can document it with POD
style documentation. Then to get an overview of how the module works you can just type this into the command line:
perldoc <module_name>
I understand that Python has a standard form of documenting code using "docstrings" that is somewhat similar to Perl's POD style. The information about the Python module can then be extracted using the help()
function, but this is far from elegant.
First you need to start the Python interpreter, then import the module you want to get help for, and then finally you can use the help()
function to get information about the module.
example:
>python
# Prints Python version info
>>>import <module_name>
>>>help(<module_name>)
# Prints documentation!
I would like a Python equivalent to the way this works for Perl:
pydoc <module_name>
but when I try this I get the following output:
'pydoc' is not recognized as an internal or external command,
operable program or batch file.
pydoc
actually does work just like perldoc
!With a catch ... you just need to type it a little different!
python -m pydoc <module_name>
Create a pydoc.bat file as shown below.
pydoc.bat:
python -m pydoc %1
Then store this file in "C:\Python27" (or in the same location as your python.exe file)
Then swiftly wave your hands over the keyboard and exclaim "SIM SALA BIM!"
your pydoc
command will now work!
pydoc <module_name>