forked from zhanghe06/python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_quote.py
More file actions
57 lines (43 loc) · 837 Bytes
/
test_quote.py
File metadata and controls
57 lines (43 loc) · 837 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
# encoding: utf-8
"""
@author: zhanghe
@software: PyCharm
@file: test_quote.py
@time: 2017/7/25 下午4:28
"""
def f(x, l=[]):
"""
引用测试
:param x:
:param l:
:return:
"""
print l
for i in range(x):
l.append(i*i)
print l
f(2)
f(3, [3, 2, 1])
f(3)
def detail():
"""
详细过程
:return:
"""
l_mem = []
l = l_mem # the first call
for i in range(2):
l.append(i*i)
print l # [0, 1]
l = [3, 2, 1] # the second call
for i in range(3):
l.append(i*i)
print l # [3, 2, 1, 0, 1, 4]
l = l_mem # the third call
for i in range(3):
l.append(i*i)
print l # [0, 1, 0, 1, 4]
if __name__ == '__main__':
# detail()
pass