I'm not sure I follow this logic. Can someone explain why float and
integer can be compared with each other and decimal can be compared to
integer but decimal can't be compared to float?
True
True
False
This seems to break the rule that if A is equal to B and B is equal to
C then A is equal to C.
--
D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
integer can be compared with each other and decimal can be compared to
integer but decimal can't be compared to float?
>>from decimal import Decimal
>>i = 10
>>f = 10.0
>>d = Decimal("10.00" )
>>i == f
>>i = 10
>>f = 10.0
>>d = Decimal("10.00" )
>>i == f
>>i == d
>>f == d
This seems to break the rule that if A is equal to B and B is equal to
C then A is equal to C.
--
D'Arcy J.M. Cain <darcy@druid.ne t | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
Comment