Message95039
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? |
|
Date |
User |
Action |
Args |
2009-11-08 09:28:50 | mark.dickinson | set | recipients:
+ mark.dickinson, skrah |
2009-11-08 09:28:50 | mark.dickinson | set | messageid: <1257672530.83.0.836585441467.issue7279@psf.upfronthosting.co.za> |
2009-11-08 09:28:49 | mark.dickinson | link | issue7279 messages |
2009-11-08 09:28:48 | mark.dickinson | create | |
|