Re: [Python-Dev] PEP 461 and __imod__

2015-01-17 Thread Ethan Furman
On 01/17/2015 07:12 PM, Ethan Furman wrote:

 I have % (__mod__) working for both bytes and bytearray (yay!), but I cannot 
 find
 nor figure out how to tell the bytearray object that 'xyz' is the __imod__ 
 function.
 
 Any pointers?

I think I found a clue in Objects/floatobject.c:

static PyNumberMethods float_as_number = {
float_add,  /*nb_add*/
float_sub,  /*nb_subtract*/
float_mul,  /*nb_multiply*/
float_rem,  /*nb_remainder*/
float_divmod,   /*nb_divmod*/
float_pow,  /*nb_power*/
(unaryfunc)float_neg, /*nb_negative*/
(unaryfunc)float_float, /*nb_positive*/
(unaryfunc)float_abs, /*nb_absolute*/
(inquiry)float_bool, /*nb_bool*/
0,  /*nb_invert*/
0,  /*nb_lshift*/
0,  /*nb_rshift*/
0,  /*nb_and*/
0,  /*nb_xor*/
0,  /*nb_or*/
float_trunc,/*nb_int*/
0,  /*nb_reserved*/
float_float,/*nb_float*/
0,  /* nb_inplace_add */
0,  /* nb_inplace_subtract */
0,  /* nb_inplace_multiply */
0,  /* nb_inplace_remainder */
0,  /* nb_inplace_power */
0,  /* nb_inplace_lshift */
0,  /* nb_inplace_rshift */
0,  /* nb_inplace_and */
0,  /* nb_inplace_xor */
0,  /* nb_inplace_or */
float_floor_div, /* nb_floor_divide */
float_div,  /* nb_true_divide */
0,  /* nb_inplace_floor_divide */
0,  /* nb_inplace_true_divide */
};

Guess I'll see if it seg faults.  ;)

--
~Ethan~



signature.asc
Description: OpenPGP digital signature
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] PEP 461 and __imod__

2015-01-17 Thread Ethan Furman
I have % (__mod__) working for both bytes and bytearray (yay!), but I cannot 
find nor figure out how to tell the
bytearray object that 'xyz' is the __imod__ function.

Any pointers?

--
~Ethan~





signature.asc
Description: OpenPGP digital signature
___
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com