pow()

Gary Herron gherron at aw.sgi.com
Wed Jul 21 15:07:13 EDT 1999
Ivan Van Laningham wrote:
> 
> Hi All--
> I couldn't find an explanation for the three-argument version of pow()
> on DejaNews, the Python 1.5.2 docs or the Python FAQ, so I'll ask now.
> 
> Can someone explain (in simple terms, for a bear of small brain) to me
> what the modulo argument to __pow__ is for?
> 
>         __pow__(self,other[,modulo])
> 

This is from the library manual named "2.3 Built-in Functions":


pow (x, y[, z]) 

Return x to the power y; if z is present, return x to the power y,
modulo z (computed more efficiently than pow(x, y) % z). The arguments
must have numeric types. With mixed operand types, the rules for binary
arithmetic operators apply.  The effective operand type is also the type
of the result; if the result is not expressible in this type, the
function raises an exception; e.g., pow(2, -1) or pow(2, 35000) is not
allowed. 

-- 
Dr. Gary Herron <gherron at aw.sgi.com>
206-287-5616
Alias | Wavefront
1218 3rd Ave, Suite 800, Seattle WA 98101




More information about the Python-list mailing list