为什么keyword.kwlist不包含'async'和'await'?

问题描述 投票:0回答:1

我有Python3.6和像async def foo(): pass一样的功能完美,但我有这个输出:

$ python
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
>>> import keyword
>>> 'async' in keyword.kwlist
False
>>> 'await' in keyword.kwlist
False

我的Python或其模块keyword有什么问题?

python python-3.x keyword
1个回答
1
投票

你的python安装没有什么问题,它只是版本3.6。

asyncawait只是自Python 3.7以来的合适关键词,按照PEP 492的计划。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.