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 rhettinger
Recipients methane, rhettinger, serhiy.storchaka, vstinner
Date 2017-12-16.09:04:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1513415049.96.0.213398074469.issue32344@psf.upfronthosting.co.za>
In-reply-to
Content
Can the peephole optimizer's fold_tuple_on_constants() be moved to ast_opt?

It looks to me like there is sufficient information in the tree:


import ast
print(ast.dump(ast.parse('c = (50+1, 60+2)')))
-----------------------------------------------
Module(body=[Assign(targets=[Name(id='c', ctx=Store())],
                    value=Tuple(elts=[BinOp(left=Num(n=50), op=Add(), right=Num(n=1)),
                                      BinOp(left=Num(n=60), op=Add(), right=Num(n=2))], ctx=Load()))],
       docstring=None)
'''
History
Date User Action Args
2017-12-16 09:04:10rhettingersetrecipients: + rhettinger, vstinner, methane, serhiy.storchaka
2017-12-16 09:04:09rhettingersetmessageid: <1513415049.96.0.213398074469.issue32344@psf.upfronthosting.co.za>
2017-12-16 09:04:09rhettingerlinkissue32344 messages
2017-12-16 09:04:09rhettingercreate