-
-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Omit optional fields from ast.dump()
#116023
Comments
I noticed that the representation on an empty
I think this is fine; it matches the constructor and it is analogous to how |
Why does the repr for |
I see that the same thing happens on Python 3.12, so this definitely isn't a regression... but I'd still be curious if anybody knows why this is different for the different nodes! |
It's because
I was thinking of whether we'd also want to default the |
Feature or enhancement
Proposal:
After #105858, it would be nice if
ast.dump()
also didn't output optional fields that are set to None or an empty string, so that its output is more concise. This should make it easier to understand the structure of large ASTs where most fields are missing.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
show_empty=False
toast.dump
#116037The text was updated successfully, but these errors were encountered: