On Tue, Mar 16, 2010 at 10:16 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > Mark Dickinson wrote: >> >> On Tue, Mar 16, 2010 at 3:58 PM, P.J. Eby <p...@telecommunity.com> wrote: >> >>> If not, it might be confusing if a number that prints as '.1' compares >>> unequal to Decimal('.1'). >> >> Agreed, but this is just your everyday floating-point confusion, to be >> dealt with by social means (e.g., educating the programmer). > > Seems to me that this education would mostly consist of saying > "don't compare floats and decimals", which is why I think that > disallowing them in the first place would be better.
I was thinking of something more along the lines of: "Sure, go ahead and compare floats and decimals, but be aware that float('1.1') is not exactly 1.1, so don't complain when 1.1 == Decimal('1.1') returns False." For me, this actually a plus of allowing these comparisons: it makes the education easier. "Look, the binary float stored for 1.1 is actually larger than 1.1, and here's the proof: >>> 1.1 > Decimal('1.1') -> True." -- Mark _______________________________________________ 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