.. _python39_new_parser: ============================================================================== **PEP 617** New PEG Parser ============================================================================== .. seealso:: - https://www.python.org/dev/peps/pep-0617/ - https://docs.python.org/3.9/whatsnew/3.9.html#pep-617-new-parser - https://pyfound.blogspot.com/2020/04/replacing-cpythons-parser-python.html - https://pyfound.blogspot.com/2020/04/the-2020-python-language-summit.html .. figure:: emily_pep617.png :align: center https://fediverse.org/emilyemorehouse/status/1255220791198781448?s=20 .. figure:: van_rossum.png :align: center https://fediverse.org/jessejiryudavis/status/1256258083367550976?s=20 Description ============= Python 3.9 **uses a new parser, based on PEG instead of LL(1)**. The new parser’s performance is roughly comparable to that of the old parser, but the PEG formalism is more flexible than LL(1) when **it comes to designing new language features**. We’ll start using this flexibility in **Python 3.10 and later**. The **ast module** uses the new parser and produces the same AST as the old parser. In **Python 3.10**, the old parser will be deleted and so will all functionality that depends on it (primarily the parser module, which has long been deprecated). In Python 3.9 only, you can switch back to the LL(1) parser using a command line switch (-X oldparser) or an environment variable (PYTHONOLDPARSER=1). See `PEP 617`_ for more details. (Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolau in bpo-40334.) .. _`PEP 617`: https://www.python.org/dev/peps/pep-0617/