Python Style Guide

--HIDE--

Introduction

Python Language Rules

Lint Imports Packages Exceptions Global Variables Nested/Local/Inner Classes and Functions List Comprehensions Default Iterators and Operators Generators Lambda Functions Conditional Expressions Default Argument Values Properties True/False Evaluations Deprecated Language Features Lexical Scoping Function and Method Decorators Threading Power Features

Python Style Rules

Semicolons Line Length Parentheses Indentation Blank Lines Whitespace Shebang Line Comments Classes Strings Files and Sockets TODO Comments Imports Formatting Statements Access Control Naming Main

Django Style Rules

Models Views Forms Urls

Blank Lines

在顶级类或函数之间使用两个空白行,而在类函数之间使用单个空白行。

在类定义和类中第一个函数定义之间不使用空白行。

在功能或方法的合适位置使用空白行(一般在一个业务逻辑完成之后)。

results matching ""

    No results matching ""