<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.12.1">
</HEAD>
<BODY>
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.<BR>
<BR>
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:<BR>
<BR>
<TT>>>> import decimal</TT><BR>
<TT>>>> float=Decimal</TT><BR>
<TT>>>> x=1.1</TT><BR>
<TT>>>> x</TT><BR>
<TT>1.1000000000000001</TT><BR>
<TT>>>></TT> <BR>
<BR>
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*<BR>
<BR>
    Thanks a bunch,<BR>
    Mike<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<BR>
--<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
Michael B. Trausch
</TD>
<TD>
<DIV ALIGN=right><A HREF="mailto:fd0man@gmail.com">fd0man@gmail.com</A></DIV>
</TD>
</TR>
<TR>
<TD>
Phone: (404) 592-5746
</TD>
<TD>
<DIV ALIGN=right>Jabber IM: fd0man@livejournal.com</DIV>
</TD>
</TR>
</TABLE>
<BR>
Demand Freedom!  Use <I>open</I> and <I>free</I> protocols, standards, and software!
</TD>
</TR>
</TABLE>
</BODY>
</HTML>