[Python-Dev] Re: Decimal data type issues

Batista, Facundo FBatista at uniFON.com.ar
Thu Apr 22 12:21:29 EDT 2004


[Aahz]

#- 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

I'm ok with that. But I'm kinda OO newbie, so: do you have a link to "formal
theory" about this? Some example of something you've done using this design?


#- 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

That's what is WorkRep for?

Actually, I didn't messed up a lot with Decimal.py. I writed a lot of code
in test_Decimal.py, and then added from_float to Deicmal and fixed a lot of
small details: but just to comply with the test cases.

A fundamental redesign of Decimal will be delayed until have all the test
cases finished and working. But I think that will be needed in the seek of
performance.


#- 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.

Michael proposed to use the same method. This is different from Decimal
(with all that that implies), but can you trust that the user that uses the
method from context is aware of binary float traps?

You propose another method. Its name is not clear to me:
context.from_float() ?

.	Facundo

  



More information about the Python-Dev mailing list