2008/5/6, Yuan HOng <[EMAIL PROTECTED]>:
>  It seems decimal object will always be larger than float in
>  comparasion, which goes against common sense:
>
>  >>> from decimal import Decimal
>  >>> a = Decimal('0.5')
>  >>> a > 99999
>  False
>  >>> a > 99999.0
>  True
>
>  It seems to me that rather than allowing this to happen, comparasion
>  between the two should either be made correct (by convertion decimal
>  to float e.g.) or forbidden, like arithmatic operations between the
>  two types.

Looks like a nasty bug.

a > 99999.0 returns True because NotImplemented > 99999.0 returns True.
a < 99999.0 returns False because NotImplemented < 99999.0 returns False.

As you can see the real comparision has nothing to do with your Decimal number.
I think you can report it at bugs.python.org.

-- 
Regards,
Wojtek Walczak
http://www.stud.umk.pl/~wojtekwa/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to