A concise tutorial for Python

Source: Internet
Author: User
Docstrings
The document string is a string of multiple lines, where the first line begins with a capital letter and ends with a period. The second behavior is a blank line, followed by a third line beginning with any detailed explanation .
It is strongly recommended that you follow this convention in the documentation string for all your extraordinary features. We can get the document string property of the function Print_max by using the function's __doc__ (note the double-down route) property (which belongs to the function's name).
Just remember that Python treats everything as an object, which naturally includes functions. We'll discuss more details about the object in the Class section later. + If you've ever used Python's help () function, you should already know the purpose of the document string. What it does is get the __doc__ property of the function and present it to you in a neat way.
。 You can try it in the function above-just include help (Print_max) in the program. Remember that you can exit help by pressing the Q key. Automation tools can retrieve documents in your program in this way. Therefore, I strongly recommend that you write all the extraordinary functions for you with a document string.
The Pydoc command included with your Python release is similar to help () using a document string.

A concise tutorial for Python

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.