http://stackoverflow.com/questions/356161/python-coding-standards-best-practices/684233#684233
I stick to PEP-8 very closely.
There are three specific things that I can't be bothered to change to PEP-8.
Avoid extraneous whitespace immediately inside parentheses, brackets or braces.
Suggested: spam(ham[1], {eggs: 2})
I do this anyway: spam( ham[ 1 ], { eggs: 2 } )
Why? 30+ years of ingrained habit is snuggling ()'s up against function names or (in C) statements keywords. Starting with Fortran IV in the 70's.
Use spaces around arithmetic operators:
Suggested: x = x * 2 - 1
I do this anyway: x= x * 2 - 1
Why? Gries' The Science of Programming suggested this as a way to emphasize the connection between assignment and the variable who's state is being changed.
It doesn't work well for multiple assignment or augmented assignment, for that I use lots of spaces.
For function names, method names and instance variable names
Suggested: lowercase, with words separated by underscores as necessary to improve readability.
I do this anyway: camelCase
Why? 20+ years of ingrained habit of camelCase, starting with Pascal in the 80's.
https://www.python.org/dev/peps/pep-0008/
댓글 영역