[Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

Guido van Rossum guido@python....
Fri Apr 27 09:14:16 CDT 2007


On 4/27/07, Jan Grant <jan.grant@bristol.ac.uk> wrote:
> On Thu, 26 Apr 2007, Dan Christensen wrote:
>
> > Note also that double-precision reals are a subset of the rationals,
> > since each double precision real is exactly representable as a
> > rational number, but many rational numbers are not exactly
> > representable as double precision reals.  Not sure if this means
> > that reals should be a subclass of the rationals.
>
> Not quite all: the space of doubles include a small number of things
> that aren't representable by a rational (+/- inf, for instance).

This suddenly makes me think of a new idea -- perhaps we could changes
the type of Inf and NaNs to some *other* numeric type? We could then
reserve a place in the numeric hierarchy for its abstract base class.
Though I don't know if this extends to complex numbers with one or
both parts NaN/Inf or not.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Numpy-discussion mailing list