Terry Reedy tjreedy at udel.edu
Wed Oct 22 19:15:22 CEST 2014

On 10/22/2014 4:27 AM, ast wrote:
> Hello
> If i am writing (-1)**1000 on a python program, will the
> interpreter do (-1)*(-1)*...*(-1) or something clever ?

The answer depends on the implementation.

> In fact i have (-1)**N with N an integer potentially big.
> I do some tests that suggest that Python is clever

You probably mean "CPython is clever".  Other implementations may or may 
not have the same optimizations.

Terry Jan Reedy

More information about the Python-list mailing list