函数返回值
函数作用域
x = 5
def foo():
y = x +1
x = x + 1
print(x)
foo()
z = 10
def foo():
golbal z
z += 2
print(z)
foo()
def counter():
c = [0]
def inner():
c[0] += 1 # 使用了外层自由变量的引用,外部的变量将保持对象计数引用
return c[0]
return inner
foo = counter()
# inner() # 不可见
print(foo(), foo())
c = 200
print(foo())
什么是浅copy
什么是深copy