![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.python archiveRe: "pow" (power) function
From: Paul Rubin <//phr.cx@NOSPAM.invalid>
Date: Fri Mar 17 2006 - 10:41:36 CET
"Russ" <uymqlp502@sneakemail.com> writes:
I think the explanation is likely here:
Python 2.3.4 (#1, Feb 2 2005, 12:11:53)
See, x**.5 does two immediate loads and an inline BINARY_POWER bytecode.
>>> def g(x): return sqrt(x)
sqrt(x), on the other hand, does a lookup of 'sqrt' in the global
If you do something like
def h(x, sqrt=sqrt):
you replace the LOAD_GLOBAL with a LOAD_FAST and that might give a
>>> dis.dis(h)
|