Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-06 Thread kveretennicov
(Please excuse my English) Fredrik Lundh wrote: > is this > > >>> 1.0 > "0" > False > > also a bug ? It may be tolerable for unrelated types like int and list, but it's a gross usability issue when it comes to mixing floats and decimals. I believe the latter are going to be mixed and com

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-06 Thread Magnus Lycka
Sergei Organov wrote: > Well, without reading the manuals I'd expect this to raise an exception > instead of yielding of meaningless and confusing result, consider: Without reading the manuals, you can only expect that Python will be "compatible" with the ideas you have of things based on previous

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Fredrik Lundh
Tim Hochberg wrote: > It's not a bug, but it is a misfeature. In 3.0, I'd love to see > nonsensical comparisons raise TypeError, but still keep the ability to > sort lists of heterogeneous objects. One approach would be keep cmp(x,y) > permissive in its arguments while making __gt__ and friends st

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Tim Hochberg
Fredrik Lundh wrote: > "Cassiano, Marco" wrote: > > >>I have difficulties with a weird Python 2.4.2 behaviour in comparing >>Decimal to Floats. >> >>For Example : >> >> >> >from decimal import Decimal >a=Decimal('3.7') >b=6.3 >> >if a > b :print a,b,'a is greater than b - NOT TRUE

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Sergei Organov
"Fredrik Lundh" <[EMAIL PROTECTED]> writes: > "Cassiano, Marco" wrote: > >> I have difficulties with a weird Python 2.4.2 behaviour in comparing >> Decimal to Floats. >> >> For Example : >> >> >> >>> from decimal import Decimal >> >>> a=Decimal('3.7') >> >>> b=6.3 >> >> >>> if a > b :print a,b,'a

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Fredrik Lundh
"Cassiano, Marco" wrote: > I have difficulties with a weird Python 2.4.2 behaviour in comparing > Decimal to Floats. > > For Example : > > > >>> from decimal import Decimal > >>> a=Decimal('3.7') > >>> b=6.3 > > >>> if a > b :print a,b,'a is greater than b - NOT TRUE' > ... else: print a,b,'b

Re: Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Steve Holden
Cassiano, Marco wrote: > I have difficulties with a weird Python 2.4.2 behaviour in comparing Decimal > to Floats. > > For Example : > > > from decimal import Decimal a=Decimal('3.7') b=6.3 > > if a > b :print a,b,'a is greater than b - NOT TRUE' > > ... else: print a,b,

Incorrect Decimal-Float behaviour in comparison tests

2006-03-03 Thread Cassiano, Marco
I have difficulties with a weird Python 2.4.2 behaviour in comparing Decimal to Floats. For Example : >>> from decimal import Decimal >>> a=Decimal('3.7') >>> b=6.3 >>> if a > b :print a,b,'a is greater than b - NOT TRUE' ... else: print a,b,'b is greater than a - CORRECT' ... 3.7 6.3 a