我想知道为什么这是 Python 3.4 中的语法错误:
some_function(
filename = "foobar.c",
**kwargs,
)
在删除 **kwargs
后的尾随逗号时有效。
最佳答案
正如 vaultah 所指出的(出于某种原因他懒得发布答案),这是 reported on the issue tracker从那以后就改变了。从 Python 3.6 开始,语法将正常工作。
To be explicit, yes, I want to allow trailing comma even after
*args
or**kwds
. And that's what the patch does. —Guido van Rossum
关于python - 传递 **kwargs 和尾随逗号的语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33350454/