[Python-ideas] Disallow orderring comparison to NaN
Antoine Pitrou
solipsis at pitrou.net
Sat Apr 30 12:30:55 CEST 2011
On Thu, 28 Apr 2011 20:38:13 -0500
Robert Kern <robert.kern at gmail.com> wrote:
> On 4/28/11 5:10 PM, Guido van Rossum wrote:
> > On Thu, Apr 28, 2011 at 12:25 PM, Alexander Belopolsky
> > <alexander.belopolsky at gmail.com> wrote:
> >> I posted a patch implementing this proposal on the tracker:
> >>
> >> http://bugs.python.org/issue11949
> >
> > Interesting indeed! I'd like to hear from the numpy folks about this.
>
> I'm personally -1, though mostly on general conservative principles. I'm sure
> there is some piece of code that will break, but I don't know how significant it
> would be.
>
> I'm not sure that it solves a significant problem. I've never actually heard of
> anyone running into an infinite cycle due to NaNs, though a bit of Googling does
> suggest that it happens sometimes.
Same as Robert. This does not seem very useful and may break existing
code.
It also opens the door for attacks against code which takes floats as
input strings and parses them using the float() constructor. An
attacker can pass "nan", which will be converted successfully and can
later raise an exception at an arbitrary point. Applications will have
to actively protect against this, which is an unnecessary nuisance.
Regards
Antoine.
More information about the Python-ideas
mailing list