Mark Dickinson <dicki...@gmail.com> added the comment: There's a second issue to consider here, which is that Python uses equality as specified by the == operator as the basic equivalence relation for set and dict membership tests. So as a general rule, an equality test between two objects of the same type shouldn't be raising exceptions. If == raised for comparisons with nans then it would make it awkward to put nans into a set.
Hmm. But now I notice that you can't put Decimal nans into sets anyway: you get a 'TypeError: Cannot hash a NaN value'. I'm not sure of the rationale for this. One might also question whether Decimal("NaN") < 9 should really be raising InvalidOperation, or whether (as an operation that doesn't return a Decimal instance and is in some sense outside the scope of the standard- --similar to int(Decimal('nan')) and hash(Decimal('nan'))) it should be raising some general Python exception instead. I'm closing this as invalid: the behaviour isn't a bug, at least in the sense that the code is working as designed. I think there may well be a useful discussion here, but the bugtracker isn't the right place to have it: could we move it to python-dev instead? ---------- resolution: -> invalid status: open -> closed _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7279> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com