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

2020-04-08 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Adding issue 39981 as a dependency. -- dependencies: +Default values for AST Nodes ___ Python tracker ___

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

2020-03-16 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Actually I have a better solution for this (which I hope to share really soon if it works.) I think we can do default value initialization for both Nones (with your patch) and lists, it requires a bit of extra work but I think I can do it. --

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

2020-03-16 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: @serhiy.storchaka, with these ASDL signatures, I have a patch that would omit default values for both Nones and [] in case they are redundant. But this is a bit different than your approach so I wanted to ask what's your opinion about adding an extra

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

2020-03-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset b7e9525f9c7ef02a1d2ad8253afdeb733b0951d4 by Serhiy Storchaka in branch 'master': bpo-36287: Make ast.dump() not output optional fields and attributes with default values. (GH-18843)

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

2020-03-09 Thread Brett Cannon
Change by Brett Cannon : -- nosy: -brett.cannon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2020-03-08 Thread Batuhan Taskaya
Batuhan Taskaya 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

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

2020-03-08 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: Related issue: issue 39638 -- ___ Python tracker ___ ___ Python-bugs-list mailing list

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

2020-03-08 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: PR 18843 solves this issue by setting None as class attributes for optional fields and attributes (like "kind" or "end_col_offset"). It is not so easy for fields like "type_ignores". They are mutable lists, so this approach cannot be applied to them. I

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

2020-03-07 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +18200 pull_request: https://github.com/python/cpython/pull/18843 ___ Python tracker ___

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

2019-11-19 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: No objections from me assuming you are going forward along the way proposed by Serhiy (i.e. only skip values for certain fields if value is the default, not a blanket skip for all Nones and empty lists). -- ___

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

2019-11-18 Thread Emmanuel Arias
Emmanuel Arias added the comment: Hi, Sorry sincerely I forgot this issue, if there are not any objection I can continue it. -- ___ Python tracker ___

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

2019-11-18 Thread Batuhan
Batuhan added the comment: @eamanu are you still interested in this issue? (bumped to 3.9) -- nosy: +BTaskaya versions: +Python 3.9 ___ Python tracker ___

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

2019-03-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: None can not be ignored in Constant(value=None). [] can not be ignored in Tuple(elts=[]). There is also a problem with using ast.dump() with annotate_fields=False: >>> from ast import * >>> dump(Raise(cause=Name(id='B', ctx=Load())),

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

2019-03-15 Thread Emmanuel Arias
Emmanuel Arias added the comment: Maybe we can ignore None and [] ? -- ___ Python tracker ___ ___ Python-bugs-list mailing list

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

2019-03-15 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: We can probably also skip `type_ignores` list if it is empty (which will be the case in 99% situations). -- nosy: +levkivskyi ___ Python tracker

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

2019-03-14 Thread Brett Cannon
Brett Cannon added the comment: @eamanu tests are basically always necessary. :) -- ___ Python tracker ___ ___ Python-bugs-list

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

2019-03-14 Thread Emmanuel Arias
Change by Emmanuel Arias : -- keywords: +patch pull_requests: +12299 stage: -> patch review ___ Python tracker ___ ___

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

2019-03-14 Thread Emmanuel Arias
Emmanuel Arias added the comment: Hi @serhiy.storchaka, I send a patch to Github to review. Let me know if is necessary unittest. Regards -- ___ Python tracker ___

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

2019-03-14 Thread Emmanuel Arias
Change by Emmanuel Arias : -- nosy: +eamanu ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

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

2019-03-14 Thread Serhiy Storchaka
New submission from Serhiy Storchaka : Currently ast.dump() outputs values for optional fields even if they are equal to defaults. This makes the output unnecessary verbose. For example (kind and type_comment are optional): >>> ast.dump(ast.parse('x = 1'))