unittest: Proposal to add failUnlessNear

Roy Smith roy at panix.com
Tue Jul 20 11:28:43 CEST 2004

In article <slrncfpk65.m9.apardon at trout.vub.ac.be>,
 Antoon Pardon <apardon at forel.vub.ac.be> wrote:

> Only if you want them to be. Floats are a subset
> of complex and as such can be treated exactly
> the same.

Why do you say floats are a subset of complex?  There's a reasonable 
argument that could be made that int/float and scalar/complex are 
orthogonal properties.  No reason why you shouldn't be able to have a 
set of numbers which are 2-tuples with real and imaginary parts, each of 
which has an integral value.  The set would, I believe, be closed for 
the same operations that integers are (addition, subtraction, and 

Of course, I'm talking theoretically.  In the current Python, complex 
numbers do indeed appear to have floating point components.

More information about the Python-list mailing list