Toppling the numeric tower

David Eppstein eppstein at
Thu Jul 26 11:43:45 EDT 2001

In article <DLW77.49367$Cy.6275542 at>,
 "Tim Hochberg" <tim.hochberg at> wrote:

> >    1. isnatural()
> >    2. isintegral()
> >    3. isrational()
> >    4. isreal()
> >    5. iscomplex()
> >
> >    a. isexact()
> This is too many. I would strip this down to
> A. iscomplex()
> B. isexact()
> C. isintegral()

I have to say that this would be more convenient for situations such as 
defining your own extension of number types for, say, exact arithmetic in 
Q[sqrt(3)].  Or even better Q[sqrt(-3)].  I was wishing I was able to do 
this recently for a different project unrelated to Python, unfortunately 
the program I was using didn't make it easy to plug in your own number 

But a couple points of clarification:
(1) is it safe to assume that isintegral() implies isexact()?
(2) should isintegral() return true for algebraic integers that are not 
rational integers?
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at

More information about the Python-list mailing list