f(name='a') name >>> def f(*a,**kw): print a for i in kw: print i >>> f([1,2],n='a',kw={1:5})#调用时,键值对可以name=value,{}的形式提供,两者之一或同时 ([1, 2],) kw n class Test(): def f(self): print self#显示self,self的实质对象的地址 >>> o=Test() &g…
add by zhj: 在Python文档中清楚的说明了默认参数是怎么工作的,如下 "Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that the same “pre-computed” value is used…