This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author freundTech
Recipients BTaskaya, Daniel Moisset, brandtbucher, freundTech, gvanrossum, kj, laurenjl, lys.nikolaou, pablogsal, rhettinger, willingc, xtreak
Date 2021-03-12.21:21:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
For the last few days I've been working with pattern matching and it's ast for a bit, while trying to add support for it to mypy.

During this I noticed an inconsistency in the ast:

ast.MatchAs has an attribute name which is of type identifier (in C) and type str (in python).

This seams really inconsistent with the rest of the ast, where identifiers are always wrapped in a ast.Name object. The only other exception to this is ast.Attribute.

Judging from Grammar/python.gram this seems deliberate:

    | pattern=or_pattern 'as' target=capture_pattern {
        _Py_MatchAs(pattern, target->, EXTRA) }

Could someone shed some light on why MatchAs directly references an identifier instead of an ast.Name?
Date User Action Args
2021-03-12 21:21:25freundTechsetrecipients: + freundTech, gvanrossum, rhettinger, willingc, Daniel Moisset, lys.nikolaou, pablogsal, xtreak, brandtbucher, BTaskaya, kj, laurenjl
2021-03-12 21:21:25freundTechsetmessageid: <>
2021-03-12 21:21:25freundTechlinkissue42128 messages
2021-03-12 21:21:25freundTechcreate