Level 2 Title grammar basics

  • 1.1 Naming Conventions
  • 1.2 Annotation Specification
    • 1.2.1 File Comments
    • 1.2.2 Comments
    • 1.2.3 Code comments
    • 1.2.4 Using TODO annotations
  • 1.3 Import Specifications
  • 1.4 Code Layout

1.1 Naming Conventions

Learn a few conventions and develop package names as you practice: use lowercase letters, not underscores. For example, com.apple.qucktime.v2 Module name: lowercase letters Class name: hump name. For example, SplitViewController exception names: use Error as the suffix, such as FileNotFoundError variable names: lowercase letters, but avoid function names like I, L,O (I uppercase, L lowercase,O uppercase) and variable constant names: uppercase letters

1.2 Annotation Specification

1.2.1 File Comments

Add a multi-line comment to the switch, telling you about the file

1.2.2 Comments

Comments are enclosed in triple double quotes, so they can be extracted by Python’s PyDoc tool, sort of like official comments

""" This is the official note this is the official note this is the official note """Copy the code

1.2.3 Code comments

Comment the code. That’s easy

Print (' Hello world')Copy the code

1.2.4 Using TODO annotations

TODO is usually commented in unfinished code, and pyCharm lets you jump right to the comments and continue writing

1.3 Import Specifications

Import the from... The import...Copy the code

1.4 Code Layout

Select the Code you want to type, press CTRL+ALT+L, or select Code from the menu bar, and then Reformat Code. What about indent: 4 Spaces or TAB once and the Code is too long? Newline after comma; Wrap a line before an operator; The continuation character “\” newline, can not use

This article is from the SDK community: www.sdk.cn