[Python-Dev] Re: Decimal data type issues

Aahz aahz at pythoncraft.com
Thu Apr 22 11:59:09 EDT 2004


On Thu, Apr 22, 2004, Batista, Facundo wrote:
>
> If yes, what about c.create_decimal(number) ?

Sounds good.  If you're going this route, it seems to me that Decimal()
would work better if it ends up being a proxy class for an internal
implementation that's more closely linked to context, and that most of
the Decimal methods simply delegate to the internal implementation
through context.  (If you look at my original implementation, that's
similar to the direction I was going -- haven't actually looked at your
code to see what it's like currently.)  Make sure that Decimal has-a
internal implementation rather than is-a (i.e. use composition instead
of subclassing).

> And with floats? c.create_decimal_from_float(number)? Or the same method
> that before?

``from_float()`` probably is better.
-- 
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