[Python-Dev] Re: Decimal data type issues (original) (raw)

Batista, Facundo FBatista at uniFON.com.ar
Mon Apr 19 09:22:18 EDT 2004


[Aahz]

#- On Fri, Apr 16, 2004, Batista, Facundo wrote: #- > #- > We all must decide which of the following is better: #- > #- > a) Decimal(number) # no context used #- > Decimal(number, context) #- > #- > b) Decimal(number) # no context used #- > Decimal.using_context(number, context) #- #- Based on my reading of Tim's posts, there's also #- #- c) Decimal(number, [context]) # context always used, with #- # optional different from default

Got it. But I think there're issues:

a) You can specifiy the context as an optional argument.

 Decimal(number, [context])

 You can pass context as an argument, and this context will
 be used at creation time. If you don't pass the context,
 ¿no context is used or is used the "default" one? (with default
 I mean the context that it's on the thread at that time).

With another specific method, that's avoided:

b) You have to specify the context in other method.

  b.1) Decimal(number)

       This way you don't use the context at creation time.

  b.2) Decimal.using_context(number, [context])

       Always a context is used at creation time. If you specify
       the context, that's the one used.  If you don't, the
       "default" context is used. 

I think the (b) syntax is more clear and less error prone. If you all agree, this can be the way to create from Decimal:

The issue is how to mix this syntax with the from_float one. What do you propose?

. 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-dev/attachments/20040419/373101ac/attachment.html



More information about the Python-Dev mailing list