[issue36287] Make ast.dump() not output optional default fields

Batuhan Taskaya report at bugs.python.org
Sun Mar 8 04:56:12 EDT 2020


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

> It is not so easy for fields like "type_ignores". They are mutable lists, so this approach cannot be applied to them.

What about keeping ASDL signatures in the nodes (). If we know the type of a field (can be parsed in runtime) we can infer the default value of a field. For type_ignores, it is a sequence so if it is empty we can just crop that part.

----------

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


More information about the Python-bugs-list mailing list