[Python-Dev] Re: Decimal data type issues

Tim Peters tim.one at comcast.net
Wed Apr 21 21:14:51 EDT 2004


[Batista, Facundo]
> I didn't reviewed all the mails to write down the community will, but
> as far I recall, you *could* use context in creation time.
>
> I think that still is not clear if to use...
>
>   Decimal(number, [context])
>
> or
>
>   Decimal(number)
>   Decimal.using_context(number, [context])
>
> ...(I prefer the laters) but I think you could use it.

The second way of spelling it is fine, but there's no need to cater to an
optional context argument.  Decimal.using_context(input) should use the
current context object.  It's been a general rule so far that all operations
are available as methods *of* context objects too, so in the goofy case (I
say "goofy" because I predict it won't be used in real life) of wanting to
force use of a particular non-current context object c, the natural spelling
is (or should be)

    c.using_context(input)




More information about the Python-Dev mailing list