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 sparverius
Recipients BTaskaya, benjamin.peterson, pablogsal, sparverius
Date 2020-02-19.18:02:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582135337.87.0.157084707534.issue39686@roundup.psfhosted.org>
In-reply-to
Content
Batuhan & Pablo thank you for your thoughts! Just wanted to reply to a few of the comments to clarify my position on the issue.


> IMHO this is not a feature that has a general usage. If you want, as far as I can see, there are some packages for doing that in PyPI already. Also, the patch looks small so you can just add this to the required project.


There seems to be movement towards a general usage. For instance, take a look at clang, in particular the flag '-ast-dump=json'.

$ clang -cc1 -ast-dump=json foo.cc


> ast.dump now can dump in pretty-printed way.

Indeed however, there is not much one can do further with the output of ast.dump. With ast.dump_json one would benefit from programmer-centric functionality.

-- 

> Thanks, Richard for your proposal. I concur with Batuhan: I am -1 as well on this addition. Echoing some of the same ideas, I think this is specialized enough that does not make sense to have it in the standard library, especially if a Pypi package already exists. 


After just browsing the the pypi package/s you may be referring to, it appears that they do so in non-standard ways.


> Additionally, this is straightforward to implement for very simple cases but PR18558 will fail for very generic ASTs if they are deep enough (it uses recursion).


The implementation of ast.dump also uses recursion. I have tested ast.dump_json on sufficiently large source files and have not run into recursion depth exceeded issues.


Thanks again for your perspective!
History
Date User Action Args
2020-02-19 18:02:17sparveriussetrecipients: + sparverius, benjamin.peterson, pablogsal, BTaskaya
2020-02-19 18:02:17sparveriussetmessageid: <1582135337.87.0.157084707534.issue39686@roundup.psfhosted.org>
2020-02-19 18:02:17sparveriuslinkissue39686 messages
2020-02-19 18:02:17sparveriuscreate