[Python-Dev] PEP for adding a decimal type to Python

Michael McLay mclay@nist.gov
Fri, 27 Jul 2001 16:32:42 -0400


On Friday 27 July 2001 11:50 am, Guido van Rossum wrote:
>
> I'm not optimistic about Michael's PEP.  He seems to insist on a total
> separation between decimal and binary numbers that I don't believe can
> work. 

I'm not insisting on total separation.  I propose that we start with a 
requirement that an explicit call be made to a conversion function.  These 
functions would allow a decimal type to be converted to a float or to an int. 
There would also be conversion function going from a float or an int to a 
decimal type.  

What I would like to avoid is creating a decimal type in Python that enables 
silent errors that are difficult to recognize.  Allowing automatic coersion 
between the binary and decimal types will open the door to errors that would 
be detected if a conversion is required.  If at some point in the future it 
becomes apparent that a particular form of coersion is safe and useful it 
could be added.  I'd like to move slowly on opening up this potential trouble 
spot.

>  I haven't replied to him yet because I can't explain it well
> enough yet -- but I don't believe there's much of a future in his
> particular idea.

I guess I'm not understanding something about the direction you are taking 
Python.   As I understood the goals of the CP4E project you were attempting 
to make Python appealing to a wider audience and make it possible for 
everyone to learn to write programs.  And then there are occasional 
references to a Python 3k which will fix some Python warts.  My proposal 
moves Python towards these goals, while retaining full backwards compatible.  
I am not trying to create a new interpreter.  I'm trying to make the current 
interpreter useful to a wider market.  What is it you are trying to 
accomplish in the process of "unifying the numerical types" in Python?