Re: in-place exponentiation incongruities

2012-08-14 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 23:53:46 UTC+2, Terry Reedy ha scritto: > > Are you actually planning to do this, or is this purely theoretical? > Yes, I do plan to implement ipow. > > Not true. Whether the function is coded in Python or C > > cls.__ipow__(base, exp, mod) # or > > base.__i

Re: in-place exponentiation incongruities

2012-08-12 Thread Terry Reedy
On 8/12/2012 7:55 AM, Giacomo Alzetta wrote: What I mean is: when you implement a new type as a C extension you have to provide special methods through the NumberMethods struct. In this struct both the power and in-place power operations have three arguments. I am not really sure why the latte

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 13:03:08 UTC+2, Steven D'Aprano ha scritto: > On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote: > > > > > From The Number Protocol(http://docs.python.org/c-api/number.html). The > > > full text is: > > > > > > PyObject* PyNumber_InPlacePower(PyObjec

Re: in-place exponentiation incongruities

2012-08-12 Thread Steven D'Aprano
On Sun, 12 Aug 2012 00:14:27 -0700, Giacomo Alzetta wrote: > From The Number Protocol(http://docs.python.org/c-api/number.html). The > full text is: > > PyObject* PyNumber_InPlacePower(PyObject *o1, PyObject *o2, PyObject > *o3) > Return value: New reference. > > **See the built-in funct

Re: in-place exponentiation incongruities

2012-08-12 Thread Giacomo Alzetta
Il giorno domenica 12 agosto 2012 06:28:10 UTC+2, Steven D'Aprano ha scritto: > 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_pow

Re: in-place exponentiation incongruities

2012-08-11 Thread Steven D'Aprano
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

in-place exponentiation incongruities

2012-08-11 Thread Giacomo Alzetta
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-pla