[Python-Dev] Mini-Pep: Simplifying the Integral ABC

Mark Dickinson dickinsm at gmail.com
Thu Jun 5 05:44:09 CEST 2008


On Sun, Jun 1, 2008 at 2:15 AM, Raymond Hettinger <python at rcn.com> wrote:

> Proposal
> --------
> Remove non-essential abstract methods like __index__, three argument
> __pow__,
> __lshift__, __rlshift__, __rshift__, __rrshift__, __and__, __rand__,
> __xor__,
> __rxor__, __or__, __ror__, and __invert__, numerator, and denominator.
>

+1 from me.

I'd support removing all these, minus the exceptions already pointed out
(__index__, numerator, denominator).  As a (so far incomplete) effort
to speed up the Decimal type I recently implemented a decimal-based
integer type;  this type would seem a natural candidate to inherit
from Integral, but the logical and shift operators above make less sense
for this type.

The other odd man out here is three-argument pow;  this *is* a
method that makes sense for integers without reference to the
way they're stored.  So maybe this should stay.  (Though I've
occasionally wondered why three-argument pow is part of the
core language, rather than being in the standard library.)

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20080604/10d51011/attachment.htm>


More information about the Python-Dev mailing list