[Python-ideas] [Python-Dev] The Case Against Floating Point ==
dickinsm at gmail.com
Fri Mar 14 16:00:37 CET 2008
On Fri, Mar 14, 2008 at 5:01 AM, Imri Goldberg <lorgandon at gmail.com> wrote:
> Alright, I agree it's a good idea to drop the proposal to changing
> floating point == into an epsilon compare.
> What about issuing a warning though?
> Consider the following course of action. It is the one with the least
> == for regular floating point numbers now issues a warning, but still
> works. This warning might be turned off. All other operators are left
> Do you think this should be dropped as well?
To be honest, yes. There isn't currently a SmellyCodeWarning or
IsThatReallyWhatYouMeanWarning in Python, and there doesn't
seem to be a lot of precedent for warning on code constructs that
may often be wrong but also have legitimate uses. Most of
the current warnings have more to do with syntactic or semantic
changes between various versions of Python.
But I think it would be entirely appropriate to warn about
floating-point (in)equality checks in something like PyChecker
or Pylint, if you can get past the technical difficulties of detecting
floating-point comparisons statically.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas