"pow" (power) function
Paul Rubin
http
Wed Mar 15 19:19:06 EST 2006
Schüle Daniel <uval at 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.
More information about the Python-list
mailing list