[issue2531] float compared to decimal is silently incorrect.
Mark Dickinson
report at bugs.python.org
Sat Mar 21 12:08:03 CET 2009
Mark Dickinson <dickinsm at gmail.com> added the comment:
> My complaint is that it is silently wrong.
I appreciate that, but I don't see any good solution. Yes, it would be
nice if float <-> Decimal comparisons raised TypeError in 2.x. But Python
2.x has an '(almost) everything is comparable to everything else'
comparison model, so that for example a list of arbitrary Python objects
can almost always be sorted. So raising a TypeError for these comparisons
has the potential to break already existing code. Of course, it *might*
not cause any breakage at all, but it's difficult to see how one could
ever be sure of that.
I think the best we can do would be to add a warning for float <-> Decimal
comparisons. Facundo, Raymond: does this seem reasonable?
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue2531>
_______________________________________
More information about the Python-bugs-list
mailing list