complex numbers

Terry Reedy tjreedy at
Wed Jan 12 19:37:47 CET 2005

"It's me" <itsme at> wrote in message 
news:ggcFd.10634$5R.9228 at
> Precisely.   One have to convert complex number into vectors, and vector 
> of
> complex numbers into vector of vectors, list of complex numbers into list 
> of
> vectors, ...., you get the idea.

No, one would have a class with all the appropriate special methods 
defined.  This is what people did before complex was made built-in.  The 
advantage of builtin-ness is being able to write complex literals: 1 + 1j, 
etc, instead of Complex(1,1).  This and speed were two reasons to make 
complex numbers builtin.

The new decimal type, in spite of being builtin (written in C), has the 
same 'problem' because decimal literals were alread being converted to 
binary floating point.  Perhaps some day we might have 1.23d to indicate 
conversion to decimal instead.  Or perhaps 1.23 will become a decimal and 
1.23f a float.

Terry J. Reedy

More information about the Python-list mailing list