Python编码风格的空格
发布于 2021-01-29 17:58:19
Python教程说:“在运算符周围和逗号后使用空格,但不要直接在括号结构内使用:a = f(1,2)+
g(3,4)”。“不直接在包围结构内”到底是什么意思?
关注者
0
被浏览
49
1 个回答
-
这可能来自PEP
8-Python代码样式指南。具体来说,请参见“表达式和语句中的空白”部分。从该部分:
Avoid extraneous whitespace in the following situations: - Immediately inside parentheses, brackets or braces. Yes: spam(ham[1], {eggs: 2}) No: spam( ham[ 1 ], { eggs: 2 } )