Skip to content

Commit 7fb148a

Browse files
committed
[1.11.x] Fixed #27655 -- Added some guidelines to the coding style docs.
Backport of c68f5d8 from master
1 parent 48ce204 commit 7fb148a

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/internals/contributing/writing-code/coding-style.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ Python style
3333

3434
* Use four spaces for indentation.
3535

36+
* Use four space hanging indentation rather than vertical alignment::
37+
38+
raise AttributeError(
39+
'Here is a multine error message '
40+
'shortened for clarity.'
41+
)
42+
43+
Instead of::
44+
45+
raise AttributeError('Here is a multine error message '
46+
'shortened for clarity.')
47+
48+
This makes better use of space and avoids having to realign strings if the
49+
length of the first line changes.
50+
51+
* Use single quotes for strings, or a double quote if the the string contains a
52+
single quote. Don't waste time doing unrelated refactoring of existing code
53+
to conform to this style.
54+
55+
* Avoid use of "we" in comments, e.g. "Loop over" rather than "We loop over".
56+
3657
* Use underscores, not camelCase, for variable, function and method names
3758
(i.e. ``poll.get_unique_voters()``, not ``poll.getUniqueVoters()``).
3859

0 commit comments

Comments
 (0)