Stricter Whitespace Enforcement by Guido van Rossum。
- All code indented with four spaces. This will also get rid of the tabs problem!
- No redundant parentheses allowed (e.g. no "return(1)" where "return 1" would do).
- No whitespace immediately following a left parentheses or immediately before a right parenthesis.
- No whitespace before a left parenthesis that starts an argument list, or before a left square bracket that starts an index expression (e.g. "x[y]").
- No whitespace before a comma or semicolon.
- Exactly one space required after a comma or semicolon (except when at the end of a line).
- No semicolon at the end of a line (it's redundant).
- More than one consecutive space within an expression is never allowed.
- Asignment and comparison operators must be surrounded by spaces.
- The amount of whitespace on both sides of a binary operator should be the same.
- If variable amounts of whitespace are used within an expression, this should correspond to the relative priorities of the operators used. For example: "1*2 + 3*4" is okay but "1*2 + 3 * 4" is not. However, "1*2+3*4" is still encouraged.
- No space allowed before a colon.
- In a dictionary display, exactly one space required after a colon. In a slice, none.
- The short form of a block ("if x: y") is abandoned; you must use the newline-plus-indentation form.
PEP8 也真的差不多是這樣。噢,不要啦,我超喜歡用兩個空白來縮排的 ^^;
不過,月曆上 4/1 發佈的消息都得確認再三 :p 過幾天再看看是怎樣。
Posted by yungyuc
at 07:43,
0 comment,
0 trackback.
Navigate
- Previous: Rozen Maiden 第二期 TV 版製作決定 @2005/03/31
- Next: 玩 Thinkpad X series 的 CF slot 要小心 @2005/04/02
Add a trackback
Please send trackback to: http://blog.seety.org/everydaywork/2005/4/2/278/trackback/.
Add a comment