[issue36541] Make lib2to3 grammar better match Python, support the := walrus

Batuhan Taskaya report at bugs.python.org
Sun Dec 6 07:01:27 EST 2020


Batuhan Taskaya <isidentical at gmail.com> added the comment:

I don't see the point of augmenting the ast.parse, since we already have variants of proper CST implementations outside the core python. Such as github.com/davidhalter/parso/ or LibCST. 

Also for basic refactorings, it is so easy to use tokens for the refactoring and AST for the analysis! Even the ast.unparse() can be partially used (like first finding the related segment of the code through AST analysis, building the corresponding variant, unparsing it, finding the region of related tokens in the source code and replacing them). There are also quite a few libraries for using tokenize in different purposes (or wrappers) such as https://github.com/asottile/tokenize-rt or github.com/isidentical/brm.

----------
nosy: +BTaskaya

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36541>
_______________________________________


More information about the Python-bugs-list mailing list