(in)exactness of complex numbers

Guido van Rossum guido at python.org
Fri Jul 27 14:01:36 EDT 2001


Skip Montanaro <skip at pobox.com> writes:

> Once these numeric changes are all implemented, if I define a complex
> constant with either integer real or imaginary parts, e.g.
>     
>     c = 1+2.1j
> 
>     d = 1.2+5j
> 
>     e = 4+7j
> 
> should I get an integer back (exact) or a float (inexact) when asking for an
> attribute that was originally an integer?  In general, can complex numbers
> be considered to have two exactness attributes?

That's probably not worth the implementation complexity.  I expect
that all floats and complex will be considered inexact, and all
rationals and ints exact.  That seems to be the most practical set of
rules, even if it doesn't satisfy everybody.

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



More information about the Python-list mailing list