[Python-Dev] Advice on numbers.py implementation of binary mixins.

2008-06-13 Thread Raymond Hettinger
PEP-3141 outlines an approach to writing binary operators to allow the right operand to override the operation if the left operand inherits the operation from the ABC. Here is my first approximation at how to write them for the Integral mixins: class Integral(Rational): def __and__(self, oth

[Python-Dev] Advice on numbers.py implementation of binary mixins.

2008-06-14 Thread Jim Jewett
Raymond Hettinger wrote: > PEP-3141 outlines an approach to writing binary > operators to allow the right operand to override > the operation if the left operand inherits the > operation from the ABC. > Here is my first approximation at how to write > them for the Integral mixins: > class Integr

Re: [Python-Dev] Advice on numbers.py implementation of binary mixins.

2008-06-13 Thread Nick Coghlan
Raymond Hettinger wrote: The question for the group is what to put on the XXX line. 1. Limit it to type(self). This approach claims the least knowledge about other types and uses their __rand__ methods(). 2. Use type(self), int, and long. This approach says that we know that ints and longs