[issue21420] Optimize 2 ** n: implement it as 1 << n

STINNER Victor report at bugs.python.org
Fri May 2 23:57:35 CEST 2014


STINNER Victor added the comment:

Oh, the patch implements another micro-optimization: "(x << 0) is x" becomes True. I included it in the same patch to reduce the overhead for 2 ** 0.

----------
nosy: +josh.rosenberg, pitrou, serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21420>
_______________________________________


More information about the Python-bugs-list mailing list