[Python-Dev] Re: Decimal data type issues

Jewett, Jim J jim.jewett at eds.com
Fri Apr 23 11:50:28 EDT 2004


Batista, Facundo:

> can you trust that the user that uses the
> method from context is aware of binary float traps?

If they are explicitly setting a context, I think
it is reasonable to assume that.  The problem case
is when they just use the default.

	inputcontext.Decimal(1.1)

has made an explicit request for specific handling.

	Decimal(1.1) 

has not indicated any awareness.  

The catch is that we don't want "just make another
context" to become such an idiom for floats that
people do it without knowing why.

Perhaps the Context.Decimal.__init__ could delegate 
to the raise function unless/until the user had set 
an attribute of approximate_float_ok = True.

-jJ



More information about the Python-Dev mailing list