[issue39788] Exponential notation should return an int if it can

Steven D'Aprano report at bugs.python.org
Fri Feb 28 19:44:26 EST 2020


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

I agree with both Eric and Zachary, but I just wanted to point out that in a Python interpreter with a keyhole optimizer, you can expect that expressions like `1*10**9` to be a constant:

# Python 3.5
py> from dis import dis
py> dis('1*10**9')
  1           0 LOAD_CONST               4 (1000000000)
              3 RETURN_VALUE

Marco, if you are worried about the performance cost of multiplying by a power of ten when creating constants, you shouldn't.

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

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


More information about the Python-bugs-list mailing list