Confusing math problem

Ian Kelly ian.g.kelly at gmail.com
Thu Feb 21 19:19:05 EST 2013


On Thu, Feb 21, 2013 at 4:41 PM, Schizoid Man <schiz_man at 21stcentury.com> wrote:
> So how is operator.pow() different from just pow()?

math.pow() is a wrapper around the C library function.

** and operator.pow() are the same thing; the latter is just a
function version of the former.

The built-in pow() is a mutant version that takes either 2 or 3
arguments.  With 2 arguments, pow(a, b) is again equivalent to a ** b.
 With 3 arguments, pow(a, b, c) is equivalent to but more efficient
than a ** b % c, but a and b are restricted to integers.



More information about the Python-list mailing list