Re: "pow" (power) function
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "pow" (power) function

From: Paul Rubin <//phr.cx@NOSPAM.invalid>
Date: Thu Mar 16 2006 - 01:19:06 CET

Schüle Daniel <uval@rz.uni-karlsruhe.de> writes:
> >>> timeit.Timer("111**0.3").timeit()
> 2.3824679851531982
> >>> timeit.Timer("pow(111,0.3)").timeit()
> 4.2945041656494141
>
> interesting result
> seems that ** computates faster

Maybe "111**0.3" parses faster than pow(111,0.3), if timeit uses eval.
Also, pow() may incur more subroutine call overhead--better check
the bytecode for both versions.
Received on Sun Apr 30 11:58:13 2006