Skip to content

Commit d4a4f47

Browse files
committed
Adds really basic style guide for future contributions.
1 parent 68d7c0f commit d4a4f47

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

STYLE_GUIDE.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
STYLE GUIDE
2+
==============
3+
4+
Use your common sense and have some decency. Also try to stick to the following where reasonable.
5+
6+
7+
Absolute Imports
8+
----------------------
9+
10+
Always use absolute imports::
11+
12+
from __future__ import absolute_import
13+
14+
That means imports should always start with sc2reader... instead of being relative to the current module.
15+
16+
from sc2reader.utils import ReplayBuffer
17+
18+
19+
Explicit Imports
20+
---------------------
21+
22+
Prefer explicit imports to globbed imports
23+
24+
from sc2reader.events import ChatEvent
25+
26+
is better than
27+
28+
from sc2reader.events import *
29+
30+
31+
Formatting Strings
32+
-----------------------
33+
34+
Use string.format(args) instead string % (args).
35+
36+
To support python 2.6, use numerical indexes even though it is a pain in the ass::
37+
38+
"{0} minerals, {1} gas, {2} terrazine, and {3} custom".format(self.minerals, self.vespene, self.terrazine, self.custom)
39+

0 commit comments

Comments
 (0)