A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Decimal <-> float comparisons in py3k.

[Python-Dev] Decimal <-> float comparisons in py3k. [Python-Dev] Decimal <-> float comparisons in py3k.Nick Coghlan ncoghlan at gmail.com
Tue Mar 16 23:46:04 CET 2010
Steven D'Aprano wrote:
> But no such problems arise with comparisons, which will always return a 
> bool, and will avoid the current ... interesting ... behaviour. In 3.1:
> 
>>>> Decimal(1) == 1 == 1.0
> True
>>>> Decimal(1) == 1.0
> False
>>>> Decimal.from_float(1.0) == 1 == 1.0
> True
>>>> Decimal.from_float(1.0) == 1.0
> False
> 
> Replacing False with an exception doesn't make it any less bizarre.

Allowing the comparisons also doesn't introduce the potential for large
cumulative errors which are possible when actual implicit arithmetic
conversions are allowed.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
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