On Sat, 11 Aug 2012 09:54:56 -0700, Giacomo Alzetta wrote: > I've noticed some incongruities regarding in-place exponentiation. > > On the C side nb_inplace_power is a ternary function, like nb_power (see > here: > http://docs.python.org/c-api/typeobj.html? highlight=numbermethods#PyNumberMethods). > > Obviously you can't pass the third argument using the usual in-place > syntax "**=". Nevertheless I'd expect to be able to provide the third > argument using operator.ipow. But the operator module accept only the > two parameter variant.
Why? The operator module implements the ** operator, not the pow() function. If you want the pow() function, you can just use it directly, no need to use operator.pow or operator.ipow. Since ** is a binary operator, it can only accept two arguments. > The Number Protocol specify that the ipow operation ""is the equivalent > of the Python statement o1 **= o2 when o3 is Py_None, or an in-place > variant of pow(o1, o2, o3) otherwise."" Where is that from? -- Steven -- http://mail.python.org/mailman/listinfo/python-list