python3.8的参数 ‘/‘
官方解释有一个新的函数参数语法"/"指示某些函数参数必须按位置指定,不能用作关键字参数。这与用Larry Hastings的Argument Clinic工具注释的C函数的help()所示的符号相同。实验了几次def f(a, b, /, c, d, *, e, f): print(a, b, c, d, e, f)f(10, b=20, c=30, d=40, e=50, f=60)报错: f() got some positional-only arguments passed as
原创
2021-07-16 13:58:17 ·
201 阅读 ·
0 评论