You have, I have, and Python.

Source: Internet
Author: User

In both Java and. net environments, there are tools that can extract comments from the code. python is not weak in this regard, so pydoc can do this.

Pydoc is added to its standard library from python 2.1. When we call the help () command in the command line interpreter, we use it to display comments in the Code on the console. We can also use it to extract comments from the module and generate instructions for the module according to certain organization methods, including classes and methods.


The source code of Pydoc can be found in the lib folder of the python installation directory (I installed 2.4 ).

When using pydoc, you can use the-w parameter to generate an Html document for the specified module.

Example: pydoc. py-w string

In this way, a corresponding HTML file is generated in the current directory.


If you want to generate HTML files for all modules in a directory. You can use:

Pydoc. py-w Z :\


You can also use the-p parameter to start a local site, so that you can view the description of modules in the browser, for example:

Pydoc-p 1234-w z :\

After executing this command, enter the address http: // localhost: 1234/in the browser to view the description of modules. The generated document is not bad.
If you are not satisfied with the generated results, you can open the pydoc. py file to modify your favorite style.

There is also a doc generation tool: pythondoc.

 

Code folding in VS.net is a very good function, especially when the code is relatively long, it can make the code easier to read. In python, although the default IDLE does not have this function, the IDE pythonwin has this function. when you click the py file, you can see that there is a column on the left of the code editor, and there is a small horizontal bar mark next to keywords such as "class" and "def". After you click it, it will become a plus sign, at the same time, this part of code is not only "class", "def" and other keywords, even if, else, for and so on can be folded.


This makes me unable to think of the pain of viewing delphi code in the past. There are a lot of code, and I can only use the above and below to describe it. Such a feature is implemented by personally-written IDE like pythonwin, but borland has never been added to delphi, which makes people feel the vitality of python and feels sorry for borland.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.