[Python-Dev] Re: Decimal data type issues

Aahz aahz at pythoncraft.com
Mon Apr 19 10:11:44 EDT 2004


On Mon, Apr 19, 2004, Batista, Facundo wrote:
> [Aahz]
> 
> #- 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 really don't care much about what decision gets made here; I just
wanted to make sure all options were clearly specified.

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

This depends on what we choose as the mechanism for Decimal().  If the
default is contextless, then from_float() should also be contextless
with maximum precision.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I used to have a .sig but I found it impossible to please everyone..."  --SFJ



More information about the Python-Dev mailing list