Python Note 3: Comment naming style

Source: Internet
Author: User

6. Notes:

Line comments start with #, multiline comments use three single quotation marks ("') or three double quotation marks (" "), comments do not need to be aligned
Three quotes allow programmers to free themselves from the mire of quotes and special strings, keeping the so-called WYSIWYG format from beginning to finish.
A typical use case is that when you need a piece of HTML or SQL, a special string escape is cumbersome when you use a string combination.

7. Naming style:

Write Java on the hump , write the python is underlined
module Name: lowercase letters, between words with _ Division;

Package Name: Same as module name

Ad_stats     Package.ad_stats

class Name: capitalize the first letter of the word

Adstatus     

global variable names ( class variables, equivalent to static variables in Java ): uppercase letters, dividing between words with _

Number     

Normal variables: lowercase letters, between words with _ Division

instance variable: starts with _, and the other is the same as the normal variable

_price     

Private instance variable ( external access error ): Starts with __ (2 underscore), and the other is the same as the normal variable

__private_var

Proprietary variables: __ Begins, __ ends, and is typically a python-owned variable, not named in this way

__doc__     __class__

Common functions: as with normal variables:

Get_name ()    count_number ()     

Private Function ( external access error ): Starts with __ (2 underscore), and the other is the same as the normal function

__get_name ()


For more information, please refer to: http://www.cnblogs.com/Maker-Liu/p/5528213.html

Python Note 3: Comment naming style

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.