Learning the "PEP 8 -- Style Guide for Python Code" - part 1

Posted esky916

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Learning the "PEP 8 -- Style Guide for Python Code" - part 1相关的知识,希望对你有一定的参考价值。

PEP 8 -- Style Guide for Python Code

 

Tabs or Spaces?

Spaces are the preferred indentation method.

Tabs should be used solely to remain consistent with code that is already indented with tabs.

Python 3 disallows mixing the use of tabs and spaces for indentation.

Python 2 code indented with a mixture of tabs and spaces should be converted to using spaces exclusively.

When invoking the Python 2 command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!

 

Comments:

No more agree then unify the code !

以上是关于Learning the "PEP 8 -- Style Guide for Python Code" - part 1的主要内容,如果未能解决你的问题,请参考以下文章

PEP 8警告“不要使用lambda表达式使用def”用于defaultdict lambda表达式[重复]

PEP 436 -- The Argument Clinic DSL

Transfer learning & The art of using Pre-trained Models in Deep Learning

Keras: the Python deep learning API

3.PEP 8是什么?

(转)PEP 8——Python编码风格指南