[issue33682] Optimize the bytecode for float(0) ?

Steven D'Aprano report at bugs.python.org
Tue May 29 08:54:24 EDT 2018


Steven D'Aprano <steve+python at pearwood.info> added the comment:

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.

----------
nosy: +steven.daprano

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33682>
_______________________________________


More information about the Python-bugs-list mailing list