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

Aahz aahz at pythoncraft.com
Sun Jun 1 21:53:00 CEST 2008


On Sat, May 31, 2008, Raymond Hettinger 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.

The only thing I object to is removing __index__ -- the whole point of an
integral class is that it is substitutable as an index for sequences in
a way that other numeric types are not.  Having an __index__ special
method is a key indicator for duck-typing purposes not covered by the
ABC.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Need a book?  Use your library!


More information about the Python-Dev mailing list