@author jackzhenguo @desc @tag @version @date 2020/02/22
含有默认参数的函数,如果类型为容器,且设置为空:
def f(a,b=[]): # NO! print(b) return b
ret = f(1) ret.append(1) ret.append(2)
f(1)
这是可变类型的默认参数之坑,请务必设置此类默认参数为None:
def f(a,b=None): # YES! pass