Learning Google Python Style
Language Rules
pylint
A tool for finding bugs and style problems
|
|
yield
|
|
lambda
Okay for one-liners. 不用为简单函数取名字。
They are often used to define callbacks or operators for higher-order functions like map()
and filter()
.
For example
|
|
With map
and lambda
|
|
filter
and lambda
|
|
太复杂,还是loop好了
Style Rules
程序的main文件应该以 #!/usr/bin/python2
或者 #!/usr/bin/python3
开始.
在导入模块时, 将会被忽略. 因此只有被直接执行的文件中才有必要加入#!.
‘ ‘ 和 ‘=’ 要注意