在使用中忽略了一个问题,形参有些和实参类似,也不能是“关键字后面含有位置参数”,即“默认形参”后面必须不能含有“位置”形参!
def test(a=100,b):
print("test")
test(a=100,b=200)
输出:
File "test01.py", line 1 def test(a=100,b): ^ SyntaxError: non-default argument follows default argument
实际上,这种形式在写的时候,IDE中是有错误提示的
原文:http://www.cnblogs.com/gengyi/p/8016237.html
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!