Skip to content

Commit a5030fb

Browse files
committed
fix vocaburary error
1 parent 0693d0c commit a5030fb

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

project-guide/static.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
{% endraw %}
3737
```
3838

39-
* 错误的静态文件引用方式
39+
* 不恰当的静态文件引用方式
4040

4141
```html
4242
<img src="/static/img/pic1.jpg" alt="My image"/>

style-guide/code.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* 尽量不要直接将代码写在模块的顶层中,在执行主程序前应该总是检查 ``if __name__ == '__main__'`` , 这样当模块被导入时主程序就不会被执行.
66

77
```python
8-
# 错误的写法(裸代码)
8+
# 不推荐的写法(裸代码)
99
do_something()
1010

1111
# 正确的写法
@@ -23,7 +23,7 @@ if __name__ == '__main__':
2323
* 尽量不要用```+```号拼接字符串, 使用```%s```模板或```join```拼接
2424

2525
```Python
26-
# 错误的写法
26+
# 不推荐的写法
2727
print("Spam" + " eggs" + " and" + " spam")
2828
# 正确写法, 使用 join
2929
print(" ".join(["Spam","eggs","and","spam"]))
@@ -37,7 +37,7 @@ print("%s %s %s %s" % ("Spam", "eggs", "and", "spam"))
3737
**注意: 复杂情况下不适用, 列表生成式过复杂反而会导致阅读和调试困难**
3838

3939
```Python
40-
# 错误的写法
40+
# 不推荐的写法
4141
items = []
4242
for item in directory:
4343
items.append(item)
@@ -51,7 +51,7 @@ items = [item for item in directory]
5151
```Python
5252
numbers = [1, 2, 6, 9, 10 ...]
5353

54-
# 错误的写法
54+
# 不推荐的写法
5555
def even(numbers):
5656
evens = []
5757
for number in numbers:
@@ -76,7 +76,7 @@ regex_phone = re.compile(r'(13\d|14[57]|15[^4,\D]))$')
7676
* 正则表达式使用前尽量先编译好
7777

7878
```Python
79-
# 错误的写法, 不要使用未编译的正则
79+
# 不推荐的写法, 不要使用未编译的正则
8080
result = re.match(r'(^(13\d|14[57]|15[^4,\D]))$', my_phone)
8181

8282
# 正确的写法,使用前先编译

style-guide/comment_and_docs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ are also implicitly created anytime a new section starts.
5454
* 不要在文档注释复制函数定义原型, 而是具体描述其具体内容, 解释具体参数和返回值等
5555

5656
```python
57-
# 错误的写法(不要写函数原型等废话)
57+
# 不推荐的写法(不要写函数原型等废话)
5858
def function(a, b):
5959
"""function(a, b) -> list"""
6060
... ...

style-guide/overview.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def main():
6060
import os
6161
import sys
6262

63-
# 错误的写法
63+
# 不推荐的写法
6464
import sys,os
6565

6666
# 正确的写法
@@ -72,7 +72,7 @@ from subprocess import Popen, PIPE
7272
# 正确的写法
7373
from foo.bar import Bar
7474

75-
# 错误的写法
75+
# 不推荐的写法
7676
from ..bar import Bar
7777
```
7878

@@ -116,7 +116,7 @@ x = x * 2 - 1
116116
hypot2 = x * x + y * y
117117
c = (a + b) * (a - b)
118118

119-
# 错误的写法
119+
# 不推荐的写法
120120
i=i+1
121121
submitted +=1
122122
x = x*2 - 1
@@ -131,7 +131,7 @@ c = (a+b) * (a-b)
131131
def complex(real, imag):
132132
pass
133133

134-
# 错误的写法
134+
# 不推荐的写法
135135
def complex(real,imag):
136136
pass
137137
```
@@ -143,7 +143,7 @@ def complex(real,imag):
143143
def complex(real, imag=0.0):
144144
pass
145145

146-
# 错误的写法
146+
# 不推荐的写法
147147
def complex(real, imag = 0.0):
148148
pass
149149
```
@@ -154,7 +154,7 @@ def complex(real, imag = 0.0):
154154
# 正确的写法
155155
spam(ham[1], {eggs: 2})
156156

157-
# 错误的写法
157+
# 不推荐的写法
158158
spam( ham[1], { eggs : 2 } )
159159
```
160160

@@ -164,7 +164,7 @@ spam( ham[1], { eggs : 2 } )
164164
# 正确的写法
165165
dict['key'] = list[index]
166166

167-
# 错误的写法
167+
# 不推荐的写法
168168
dict ['key'] = list [index]
169169
```
170170

@@ -176,7 +176,7 @@ x = 1
176176
y = 2
177177
long_variable = 3
178178

179-
# 错误的写法
179+
# 不推荐的写法
180180
x = 1
181181
y = 2
182182
long_variable = 3
@@ -221,7 +221,7 @@ do_first()
221221
do_second()
222222
do_third()
223223

224-
# 错误的写法
224+
# 不推荐的写法
225225
do_first();do_second();do_third();
226226
```
227227

@@ -232,7 +232,7 @@ do_first();do_second();do_third();
232232
if foo == 'blah':
233233
do_blah_thing()
234234

235-
# 错误的写法
235+
# 不推荐的写法
236236
if foo == 'blah': do_blash_thing()
237237
```
238238

@@ -253,7 +253,7 @@ if foo == 'blah': do_blash_thing()
253253
# 正确的写法
254254
x = x + 1 # 边框加粗一个像素
255255

256-
# 错误的写法(无意义的注释)
256+
# 不推荐的写法(无意义的注释)
257257
x = x + 1 # x加1
258258
```
259259

style-guide/variables.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
```python
88
if __name__ == '__main__':
9-
# 错误的写法
9+
# 不推荐的写法
1010
# 尽量避免单字符变量名
1111
s = "hello world!"
1212
```
@@ -27,7 +27,7 @@ import htmlParser
2727

2828
```python
2929
if __name__ == '__main__':
30-
# 错误的写法
30+
# 不推荐的写法
3131
# 尽量避免l、O 等容易混淆的字母
3232
l = 1
3333
O = 0

0 commit comments

Comments
 (0)