2**HUGENUMBER Why not optimise it?
Delaney, Timothy
tdelaney at avaya.com
Wed May 22 20:23:07 EDT 2002
> From: Mike C. Fletcher [mailto:mcfletch at rogers.com]
>
> I've noticed the use of 2**HUGENUMBER as a speed test a
> couple of times
> now. I'm curious why the language(s) doesn't (don't) optimise 2**X
> operations for really huge exponents. Python obviously
> optimises 1**x
> (since 1**1000000 returns instantly), so why not 2**x where x
> > (30 or 62)?
Exponentiation can be overloaded. Look at __pow__ ...
Tim Delaney
More information about the Python-list
mailing list