On Sun, 21 Mar 2010 11:25:34 -0700, Raymond Hettinger <raymond.hettin...@gmail.com> wrote: > It seems to me that Decimals and floats should be considered at > the same level (i.e. both implement Real). > > Mixed Decimal and float should coerce to Decimal because it can be > done losslessly. > > There is no need to embed a notion of "imperfect answer". > Numbers themselves are exact and many mixed operations > can be exact is the coercions go the right way.
I think the concern here is rather about operations such as: 1.1 + Decimal('1.1') The calculation may produce an "exact" result, but it won't be the exact result expected, because the conversion from string (at the program text file level) to float was lossy. Thus the desire for some mechanism to know that floats and decimals have been mixed anywhere in the calculations that led up to whatever result number you are looking at. And to have doing so trigger an exception if requested by the programmer. -- R. David Murray www.bitdance.com _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com