[issue39715] Implement __repr__ methods for AST classes

Batuhan Taskaya report at bugs.python.org
Fri Feb 21 14:11:18 EST 2020


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

What kind of repr do you have in your mind? If the repr you are thinking contains field information, it would be no-go. Fields of AST objects can contain other objects and fields of that objects can contain more objects (this goes up to the recursion limit where the child can not be no longer calculated). This is why we have ast.dump instead. For small debuggings there are 3rd party libraries (e.g: asteria) which adds __repr__ on runtime for working on nodes, but on a real application this can cause more problem then it benefits.

----------

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


More information about the Python-bugs-list mailing list