gpt4 book ai didi

python - Python 中的 __peg_parser__ 是什么?

转载 作者:行者123 更新时间:2023-12-03 10:06:30 27 4
gpt4 key购买 nike

我使用的是 keyword 内置模块,用于获取当前 Python 版本的所有关键字的列表。这就是我所做的:

>>> import keyword
>>> print(keyword.kwlist)
['False', 'None', 'True', '__peg_parser__', 'and', 'as', 'assert', 'async', 'await', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
keyword.kwlist 列出有 __peg_parser__ .所以要查看它的作用,我输入 __peg_parser__在 Windows 上的 Python 3.9 解释器中(在 Mac OS 和 Linux 上你也会得到相同的输出),这就是得到的:
>>> __peg_parser__
File "<stdin>", line 1
__peg_parser__
^
SyntaxError: You found it!
所以我的问题是, __peg_parser__ 是什么?为什么我会得到 SyntaxError: You found it! ?

最佳答案

这是与 the new PEG parser 的推出有关的复活节彩蛋.复活节彩蛋,以及旧的 LL(1) 解析器,will be removed in 3.10 .

关于python - Python 中的 __peg_parser__ 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65486981/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com