Message74587
(Ok, remember that I'm not a "numeric" guy before start hitting me, :p )
I think that if we have Decimal(1)==1, and 1==1.0, to have Decimal(1)==1.0.
We always rejected comparison with "unsupported types", but having this
situation, I'd propose to put something like the following at the
beggining of __eq__() and similars:
def __eq__(self, other):
if isinstance(other, float) and int(other)==other:
other = int(other)
What do you think? |
|
Date |
User |
Action |
Args |
2008-10-09 17:05:06 | facundobatista | set | recipients:
+ facundobatista, rhettinger, terry.reedy, mark.dickinson |
2008-10-09 17:05:06 | facundobatista | set | messageid: <1223571906.4.0.244882588374.issue4087@psf.upfronthosting.co.za> |
2008-10-09 17:05:05 | facundobatista | link | issue4087 messages |
2008-10-09 17:05:05 | facundobatista | create | |
|