12 lines
237 B
Python
12 lines
237 B
Python
# parameters.defaults.mutable.py
|
|
def func(a=[], b={}):
|
|
print(a)
|
|
print(b)
|
|
print('#' * 12)
|
|
a.append(len(a)) # this will affect a's default value
|
|
b[len(a)] = len(a) # and this will affect b's one
|
|
|
|
func()
|
|
func()
|
|
func()
|