A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2010-March/098570.html below:

[Python-Dev] Decimal & amp; lt; -& amp; gt; float comparisons in py3k.

[Python-Dev] Decimal & amp; lt; -& amp; gt; float comparisons in py3k. [Python-Dev] Decimal & amp; lt; -& amp; gt; float comparisons in py3k.R. David Murray rdmurray at bitdance.com
Fri Mar 19 21:33:56 CET 2010
On Fri, 19 Mar 2010 12:16:35 -0700, Glenn Linderman <v+python at g.nevcal.com> wrote:
> On 3/19/2010 11:43 AM, Terry Reedy wrote:
> > It still strikes me as a bit crazy for Python to say that 0.0 == 0 and 
> > 0 == Decimal(0) but that 0.0 != Decimal(0). Who would expect such a 
> > thing?
> 
> The same person that would expect both
> 
> 0 == "0"
> 0.0 == "0.0"
> 
> to be False... i.e. anyone that hasn't coded in Perl for too many years.

No, those two situations are not comparable.

"if a equals b and b equals c, then a equals c" is what most people
will expect.  In fact, only mathematicians are likely to know
that any other situation could possibly be valid.  Programmers are
generally going to view it as a bug.

--
R. David Murray                                      www.bitdance.com
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4