[Python-Dev] Decimal.py in sandbox

Mike Rovner mike at nospam.com
Wed Oct 29 13:11:00 EST 2003


RE: [Python-Dev] Decimal.py in sandbox"Batista, Facundo"
<FBatista at uniFON.com.ar> wrote in message
news:A128D751272CD411BC9200508BC2194D03383128 at escpl.tcp.com.ar...
Aahz wrote:
>#- > >>> myDecimal = Decimal(5)
>#- > >>> myfloat = 3.0
>#- > >>> mywhat = myDecimal + myfloat
>#- > >>> isinstance(mywhat, float)
>#- > True
>#-
>#- Absolutely not.  No way, no how, no time.  -1000

>#- are inexactly represented in Python.  My opinion is that conversion
>#- between float and Decimal should always be explicit (and my
>I'm not decided for any option. I just want (it will be nice) the group to
decant either way. >There's some controversial about this.
>Anyway, I'll explicit the options in the pre-PEP, and we all will take a
side, :)

Why 5+3. -> 8. ok,
but Decimal(5)+3 -> 8. is not ok?

I favor implicit conversion as long as first stays true.
It's fast (no decimal arithmetic), it's understandable, it's in line with
other numeric.

Mike









More information about the Python-list mailing list