On Numbers

Alex Martelli aleax at mail.comcast.net
Mon Jan 16 04:43:37 CET 2006


Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> Mike Meyer <mwm at mired.org> writes:
> > I'd like to work on that. The idea would be that all the numeric types
> > are representations of reals with different properties that make them
> > appropriate for different uses. 
> 
> 2+3j?

Good point, so s/reals/complex numbers/ -- except for this "detail",
Mike's idea do seem well founded.

What *I* would also like would be a basenumber abstract class, like the
existing basestring, such that alternate numerics (like those I supply
in gmpy) could inherit from it in order to assert "yes, I *AM* a
number!" and allow isinstance-based checks rather than ones based on
"try to sum 0 and see if that gives an exception".  A very small,
localized, and potentially useful change, IMHO.


Alex



More information about the Python-list mailing list