array slicing and spaces around operators

[Imported from Trac: page CodingStandards, version 19]
davidsarah 2012-05-18 21:33:34 +00:00
parent 74959f206b
commit acfa389b04

@ -38,6 +38,7 @@ from allmydata.util.assertutil import _assert, precondition, postcondition
* Feel free to ignore the part of PEP-8 that says to put each module import on a separate line, but don't import modules from multiple separate packages on the same line. * Feel free to ignore the part of PEP-8 that says to put each module import on a separate line, but don't import modules from multiple separate packages on the same line.
* Ignore the part of PEP-257 which says to put the trailing `"""` of a multi-line docstring on a separate line separated by a blank line. (That rule appears to have been motivated by a limitation of Emacs which has been fixed.) * Ignore the part of PEP-257 which says to put the trailing `"""` of a multi-line docstring on a separate line separated by a blank line. (That rule appears to have been motivated by a limitation of Emacs which has been fixed.)
* Ignore the part of PEP-8 which specifes 79- or 72- char line widths. We use 77 columns. In emacs set `fill-column` to 77 (e.g. `M-x set-variable fill-column 77`). * Ignore the part of PEP-8 which specifes 79- or 72- char line widths. We use 77 columns. In emacs set `fill-column` to 77 (e.g. `M-x set-variable fill-column 77`).
* PEP 8 says: "If operators with different priorities are used, consider adding whitespace around the operators with the lowest priority(ies)." This is a good rule; note that it also applies to some non-obvious low-priority operators, like '`:`' for list slicing. (Example: `a[: d]b-c` good, `a[- c:d]b` bad. If a slice is from the start or to the end of the array, put the '`:`' immediately next to the bracket on that side.)
### truths and falsehoods ### truths and falsehoods