pow()

Christian Tismer tismer at appliedbiometrics.com
Wed Jul 21 15:06:39 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 in the docstring of the pow function.
If the result is to be modulo a modulus,
the computation might take advantage of it (I don't know wether it
does).

>>> print pow.__doc__
pow(x, y[, z]) -> number

With two arguments, equivalent to x**y.  With three arguments,
equivalent to (x**y) % z, but may be more efficient (e.g. for longs).
>>> 

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship* http://starship.python.net
10553 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home




More information about the Python-list mailing list