Decimal vs Float comparasion

Rhamphoryncus rhamph at gmail.com
Tue May 6 11:56:31 EDT 2008


On May 6, 1:31 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Tue, 6 May 2008 11:52:10 +0800, "Yuan HOng" <hongyuan1... at gmail.com>
> declaimed the following in comp.lang.python:
>
>
>
> > 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.
>
>         Why should decimal be coerced to float? Maybe float should be
> coerced to decimal?
>
>         Or... the programmer should explicitly specify what comparison is
> wanted -- if any...
>
>         Or... Isn't Python 3.x supposed to forbid mixed type comparisons
> unless the types implement suitable handling?

Yes, it is fixed in 3.0.  Unfortunately it's well established
behaviour in 2.x, so it won't be changing there.  Don't bother
reporting a bug about this unless it's about 3.0.



More information about the Python-list mailing list