Skip to content

Commit 30fb2cb

Browse files
committed
引用测试
1 parent 2f5dd30 commit 30fb2cb

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

test/test_quote.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
@author: zhanghe
6+
@software: PyCharm
7+
@file: test_quote.py
8+
@time: 2017/7/25 下午4:28
9+
"""
10+
11+
12+
def f(x, l=[]):
13+
"""
14+
引用测试
15+
:param x:
16+
:param l:
17+
:return:
18+
"""
19+
print l
20+
for i in range(x):
21+
l.append(i*i)
22+
print l
23+
24+
f(2)
25+
f(3, [3, 2, 1])
26+
f(3)
27+
28+
29+
def detail():
30+
"""
31+
详细过程
32+
:return:
33+
"""
34+
l_mem = []
35+
36+
l = l_mem # the first call
37+
for i in range(2):
38+
l.append(i*i)
39+
40+
print l # [0, 1]
41+
42+
l = [3, 2, 1] # the second call
43+
for i in range(3):
44+
l.append(i*i)
45+
46+
print l # [3, 2, 1, 0, 1, 4]
47+
48+
l = l_mem # the third call
49+
for i in range(3):
50+
l.append(i*i)
51+
52+
print l # [0, 1, 0, 1, 4]
53+
54+
55+
if __name__ == '__main__':
56+
# detail()
57+
pass

0 commit comments

Comments
 (0)