[issue32344] Explore whether peephole.c tuple of constants folding can be an AST transformation
Raymond Hettinger
report at bugs.python.org
Sat Dec 16 04:04:09 EST 2017
New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:
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)
'''
----------
assignee: serhiy.storchaka
components: Interpreter Core
messages: 308467
nosy: inada.naoki, rhettinger, serhiy.storchaka, vstinner
priority: low
severity: normal
status: open
title: Explore whether peephole.c tuple of constants folding can be an AST transformation
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32344>
_______________________________________
More information about the Python-bugs-list
mailing list