@@ -18,8 +18,17 @@ Use Python3! Check the [current time until deactivation of Python2 here](https:/
18
18
19
19
Use concise, pythonic, but ** readable** code
20
20
21
- Variables
22
- ---
21
+ ## Index
22
+ - [ Variables] ( #variables )
23
+ - [ Code Blocks] ( #code-blocks )
24
+ - [ Conditionals] ( #conditionals )
25
+ - [ Functions] ( #functions )
26
+ - [ Classes] ( #classes )
27
+ - [ Constants] ( #constants )
28
+ - [ Additional Information] ( #additional-information )
29
+
30
+ ## Variables
31
+
23
32
When creating variables, use lowercase letters throughout the names. When
24
33
creating a variable with more than one word in its name, use an underscore to
25
34
separate the words. There is no need for type declaration in Python.
@@ -44,8 +53,8 @@ amount_of_pies = 200
44
53
our_keyword = ' HelloWorld'
45
54
```
46
55
47
- Code Blocks
48
- ---
56
+ ## Code Blocks
57
+
49
58
Use tabs as indents (and remember, in Python, whitespace is important)
50
59
51
60
** WRONG(1/2)**
@@ -77,8 +86,8 @@ if one==1:
77
86
```
78
87
79
88
80
- Conditionals
81
- ---
89
+ ## Conditionals
90
+
82
91
Don't use parentheses unless necessary
83
92
84
93
** WRONG**
@@ -108,8 +117,8 @@ if b:
108
117
```
109
118
110
119
111
- Functions
112
- ---
120
+ ## Functions
121
+
113
122
Function names should be lowercase, with words separated by underscores as necessary
114
123
115
124
** WRONG**
@@ -130,8 +139,8 @@ def right_func(*args):
130
139
pass
131
140
```
132
141
133
- Classes
134
- ---
142
+ ## Classes
143
+
135
144
- Class names should use upper camel case
136
145
- Always use * self* for the first argument to instance methods
137
146
@@ -149,8 +158,8 @@ class RightClassName(object):
149
158
pass
150
159
```
151
160
152
- Constants
153
- ---
161
+ ## Constants
162
+
154
163
Constant variable names should be all uppercase, with words separated by underscores
155
164
156
165
** WRONG**
@@ -163,7 +172,7 @@ max_length, total
163
172
MAX_LENGTH , TOTAL
164
173
```
165
174
166
- ## Additional information:
175
+ ## Additional Information
167
176
<a href =' https://www.python.org/dev/peps/pep-0008/ ' >PEP 8 -- Style Guide for Python Code</a >
168
177
PEP is Python Enhancement Proposal.
169
178
0 commit comments