diff options
| author | Tim Graham <timograham@gmail.com> | 2017-06-12 15:39:09 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-06-12 15:39:25 -0400 |
| commit | 7fb148a638044e96fea9996115deb334992ec072 (patch) | |
| tree | 9016c735b190d24a6da152a2ec2c7bc34b09e1b5 | |
| parent | 48ce204488c6cca8ab453a756fa655f0c886533c (diff) | |
[1.11.x] Fixed #27655 -- Added some guidelines to the coding style docs.
Backport of c68f5d83c0a4ea4ccf87c7d1d5dd1e9f7b2907a3 from master
| -rw-r--r-- | docs/internals/contributing/writing-code/coding-style.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index 189e7c7426..0d3ba8da1f 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -33,6 +33,27 @@ Python style * Use four spaces for indentation. +* Use four space hanging indentation rather than vertical alignment:: + + raise AttributeError( + 'Here is a multine error message ' + 'shortened for clarity.' + ) + + Instead of:: + + raise AttributeError('Here is a multine error message ' + 'shortened for clarity.') + + This makes better use of space and avoids having to realign strings if the + length of the first line changes. + +* Use single quotes for strings, or a double quote if the the string contains a + single quote. Don't waste time doing unrelated refactoring of existing code + to conform to this style. + +* Avoid use of "we" in comments, e.g. "Loop over" rather than "We loop over". + * Use underscores, not camelCase, for variable, function and method names (i.e. ``poll.get_unique_voters()``, not ``poll.getUniqueVoters()``). |
