I'm sorry, it isn't clear what optimizations for float(X) and int(X) you are referring to. I can only guess that you want to optimize: float(0) to use LOAD_CONST 0.0 instead of calling the float() function. If that is what you want, we can't do that because float() may have been shadowed or replaced. Optimizing 1+1 is safe because it involves only literals and operators, no name look-ups. If that is not what you want, please explain what optimization you are referring to.
@Victor, Thanks and you are right, int and float are not keywords of Python, in this case, we can override them. @Steven, in fact, the optimization was, when you see float/int (if they are keywords), don't call the function via the bytecode. Thanks and I close this issue.
History
Date
User
Action
Args
2022-04-11 14:59:01
admin
set
github: 77863
2018-05-29 13:01:34
matrixise
set
status: open -> closedresolution: not a bugstage: resolved