Adrian Freund <g...@freundtech.com> added the comment:
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: as_pattern[expr_ty]: | pattern=or_pattern 'as' target=capture_pattern { _Py_MatchAs(pattern, target->v.Name.id, EXTRA) } Could someone shed some light on why MatchAs directly references an identifier instead of an ast.Name? ---------- nosy: +freundTech _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42128> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com