Is there a way to use Decimal() by default in Python instead of float?  I've no use for the float type, and I have some stuff that would require Decimal(), but it is kind of a pain to try and cast things all over the place all the time.  Float is just way too inexact for me.

I am searching around, and I don't see anything helpful, but I could (as always) be missing something... I tried (rather naïvely) to just do something like:

>>> import decimal
>>> float=Decimal
>>> x=1.1
>>> x
1.1000000000000001
>>>

But, that didn't work (obviously).  It was a shot, anyway.  Are there any ideas, or does anyone have a way around this?  I would prefer to not have to convert incoming floating point numbers to strings and then convert them to Decimal() types every single time that I want to use them (which would be in *every* case).  For example, I have a ZIP code database that can do some processing on its numbers, and the numbers are stored as floating point values (exactly) but Python doesn't get them right; so the Decimal() thing would be needed.  *shrugs*

    Thanks a bunch,
    Mike

--
Michael B. Trausch
Phone: (404) 592-5746
Jabber IM: [EMAIL PROTECTED]

Demand Freedom!  Use open and free protocols, standards, and software!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to