prePEP: Decimal data type

Batista, Facundo FBatista at uniFON.com.ar
Wed Nov 5 12:46:35 EST 2003


John Roth wrote:

#- literal. As currently defined, Decimal(1.1) and Decimal("1.1")
#- go through the same process: 1.1 first gets converted to a float,
#- and then converted a second time to a Decimal. I'd rather not
#- have even the potential for confusion.

Where's that defined?

Decimal(1.1) != Decimal("1.1") unless you choose an "being discused" option
(j).


#- Part of the reason for wanting a type (rather than a class)
#- is that it's much easier to justify a specific literal for a
#- built in type. And it would not be that hard to do either,
#- 1.1D is quite natural, and not all that easy to mistake for
#- a float (the D isn't part of the float syntax in Python,
#- although it is in other languages.)

I think that this first must get into the standard library. Then we all can
discuss if goes builtin.


#- My personal opinion in the matter is that setting the precision high
#- enough so that you won't get into trouble is a hack, and 
#- it's a dangerous
#- hack because the amount of precision needed isn't directly 
#- related to the
#- data you're processing; it's something that came out of an analysis,
#- probably by someone else under some other circumstances. Given
#- a software implementation, there's a performance advantage 
#- to setting it as
#- low
#- as possible, which immediately puts things at risk if your data
#- changes.

This is why I'm still unsure of using Decimal as a superclass for Money.

.	Facundo





. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . .
ADVERTENCIA  

La información contenida en este mensaje y cualquier archivo anexo al mismo,
son para uso exclusivo del destinatario y pueden contener información
confidencial o propietaria, cuya divulgación es sancionada por la ley. 

Si Ud. No es uno de los destinatarios consignados o la persona responsable
de hacer llegar este mensaje a los destinatarios consignados, no está
autorizado a divulgar, copiar, distribuir o retener información (o parte de
ella) contenida en este mensaje. Por favor notifíquenos respondiendo al
remitente, borre el mensaje original y borre las copias (impresas o grabadas
en cualquier medio magnético) que pueda haber realizado del mismo. 

Todas las opiniones contenidas en este mail son propias del autor del
mensaje y no necesariamente coinciden con las de Telefónica Comunicaciones
Personales S.A. o alguna empresa asociada. 

Los mensajes electrónicos pueden ser alterados, motivo por el cual
Telefónica Comunicaciones Personales S.A. no aceptará ninguna obligación
cualquiera sea el resultante de este mensaje. 

Muchas Gracias.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20031105/c99b7a8c/attachment.html>


More information about the Python-list mailing list