FixedPoint
Tim Peters
tim.one at home.com
Thu Feb 7 23:06:10 EST 2002
[Tim]
> Magnitude (as opposed to identity -- "is") comparision of a FixedPoint
> to a non-numeric object makes no sense that I'm comfortable imposing, so
> I'm happy to let it raise an exception.
[Brian Quinlan]
> You shouldn't be. There is no more reason for FixedPoint to raise an
> exception (aside from your desire not to bother fixing it :-) than for
> other other "incompatible" types e.g.
>
> >>> 5 == 5 + 5j
> 0
> >>> 5 == '5'
> 0
Note that I said "non-numeric object". FixedPoint supports a rich set of
auto-coercions from types that "make sense". I'm not a fan of semantically
senseless comparisons, e.g.
>>> 5 < '5'
1
>>>
Making it easy to supply ridiculous behaviors in subclasses is what OO is
all about <wink>.
More information about the Python-list
mailing list