Skip to content

Commit 6e74365

Browse files
author
Ernest
committed
add index for python
1 parent a58b379 commit 6e74365

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

guides/coding_style/python/README.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ Use Python3! Check the [current time until deactivation of Python2 here](https:/
1818

1919
Use concise, pythonic, but **readable** code
2020

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+
2332
When creating variables, use lowercase letters throughout the names. When
2433
creating a variable with more than one word in its name, use an underscore to
2534
separate the words. There is no need for type declaration in Python.
@@ -44,8 +53,8 @@ amount_of_pies = 200
4453
our_keyword = 'HelloWorld'
4554
```
4655

47-
Code Blocks
48-
---
56+
## Code Blocks
57+
4958
Use tabs as indents (and remember, in Python, whitespace is important)
5059

5160
**WRONG(1/2)**
@@ -77,8 +86,8 @@ if one==1:
7786
```
7887

7988

80-
Conditionals
81-
---
89+
## Conditionals
90+
8291
Don't use parentheses unless necessary
8392

8493
**WRONG**
@@ -108,8 +117,8 @@ if b:
108117
```
109118

110119

111-
Functions
112-
---
120+
## Functions
121+
113122
Function names should be lowercase, with words separated by underscores as necessary
114123

115124
**WRONG**
@@ -130,8 +139,8 @@ def right_func(*args):
130139
pass
131140
```
132141

133-
Classes
134-
---
142+
## Classes
143+
135144
- Class names should use upper camel case
136145
- Always use *self* for the first argument to instance methods
137146

@@ -149,8 +158,8 @@ class RightClassName(object):
149158
pass
150159
```
151160

152-
Constants
153-
---
161+
## Constants
162+
154163
Constant variable names should be all uppercase, with words separated by underscores
155164

156165
**WRONG**
@@ -163,7 +172,7 @@ max_length, total
163172
MAX_LENGTH, TOTAL
164173
```
165174

166-
## Additional information:
175+
## Additional Information
167176
<a href='https://www.python.org/dev/peps/pep-0008/'>PEP 8 -- Style Guide for Python Code</a>
168177
PEP is Python Enhancement Proposal.
169178

0 commit comments

Comments
 (0)