标签:
@1:
>>> def func(a, L=[]): ... L.append(a) ... print(L) ... >>> func(10) [10] >>> func(20) [10, 20]
如果你不理解上面的代码的输出,可以参考下面的文章
【陷阱!】Python可变缺省参数: http://blog.csdn.net/imzoer/article/details/8686738
@2:
标签:
原文地址:http://www.cnblogs.com/lxw0109/p/python-trips-and-pitfalls.html