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

Raymond Hettinger python at rcn.com
Wed Jun 4 21:57:11 CEST 2008


From: "Guido van Rossum" <guido at python.org>
> Unless more folks actually say they agree I don't want to go forward
> with this. There was quite a bit of discussion about PEP 3141 and it
> was accepted; striking this much from it with virtually no discussion
> seems wrong to me.

Not sure how to generate more discussion.  It seems self-evident
that an abc with lots of abstract methods is inherently less usable
and that bitwise operations go beyond the basic notion of "integeriness".
Requiring all those methods to be defined makes it harder to write
a compliant class.  Other than int/long, no currently existing type 
matches-up with Integral.  Does anyone care about this?

If something like numpy's int8 eventually grows the required methods,
it is worriesome that the numerator/denominator properties will be
automatically supplied for fractions.py to accept as inputs eventhough
int8's wrap-around behavior makes them entirely unsuitable.  I don't
know if this bothers anyone.  It would seem that a consumer of an Integral
can assume the existence of methods but nothing about whether the
result is usable.  That might not be a big deal except that numpy is t
he only known use case.

Hopefully, some discussion gets generated.  But if no one cares, 
I'll happily drop it.


Raymond




More information about the Python-Dev mailing list