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/098443.html below:

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

[Python-Dev] Decimal <-> float comparisons in py3k. [Python-Dev] Decimal <-> float comparisons in py3k.Victor Stinner victor.stinner at haypocalc.com
Tue Mar 16 17:18:50 CET 2010
Le mardi 16 mars 2010 16:58:22, P.J. Eby a écrit :
> At 09:58 AM 3/16/2010 -0500, Facundo Batista wrote:
> >I'm +0 to allow these comparisons, being "Decimal(1) < .3" the same as
> >"Decimal(1) < Decimal.from_float(.3)"
> 
> Does Decimal.from_float() use the "shortest decimal representation"
>  approach?
> 
> If not, it might be confusing if a number that prints as '.1'
> compares unequal to Decimal('.1').

In py3k, comparing bytes and str raise a TypeError("unorderable types: bytes() 
< str()"). I like this behaviour :-)

If comparaison of Decimal and float can have "unpredictable" result, I would 
suggest the same behaviour (raise an error).

-- 
Victor Stinner
http://www.haypocalc.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