Python 3.x 函数默认参数的Python无效语法错误
这是我的代码,我看不出有任何问题Python 3.x 函数默认参数的Python无效语法错误,python-3.x,Python 3.x,这是我的代码,我看不出有任何问题 def test_methopd(async=False): pass 当我导入模块时,出现以下错误 $ python3 -c "import test" File "/Users/gaurang.shah/Documents/ctc/code/ci-cd-framework/atf/clients/test.py", line 1 def test_methopd(async=False):
def test_methopd(async=False):
pass
当我导入模块时,出现以下错误
$ python3 -c "import test"
File "/Users/gaurang.shah/Documents/ctc/code/ci-cd-framework/atf/clients/test.py", line 1
def test_methopd(async=False):
^
SyntaxError: invalid syntax
代码在Python3.4.9上运行良好,但在Python3.7.0上出现错误,因为Python3.7
异步
是一个保留字,不能用作标识符(例如参数名)
描述这一变化的政治公众人物:
折旧计划
async
和await
名称在CPython 3.5和
3.6. 在3.7中,我们将把它们转换为适当的关键字
这也反映在在线文档中: