abhi9u@lemmy.world to Technology@lemmy.worldEnglish · 4 个月前How Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.comexternal-linkmessage-square43fedilinkarrow-up1143arrow-down18
arrow-up1135arrow-down1external-linkHow Python Compares Floats and Ints: When Equals Isn’t Really Equalblog.codingconfessions.comabhi9u@lemmy.world to Technology@lemmy.worldEnglish · 4 个月前message-square43fedilink
minus-squareSylvartas@lemmy.worldlinkfedilinkEnglisharrow-up1·4 个月前Meh. Imo anyone comparing an integer to a float and not expecting one of them to be implicitly casted to the other’s type will create that issue for themselves when doing the same thing with an explicit cast.
minus-squareMiaou@jlai.lulinkfedilinkEnglisharrow-up3·4 个月前What I meant is, the former can be a genuine mistake, the latter is a conscious (probably uneducated) decision
Meh. Imo anyone comparing an integer to a float and not expecting one of them to be implicitly casted to the other’s type will create that issue for themselves when doing the same thing with an explicit cast.
What I meant is, the former can be a genuine mistake, the latter is a conscious (probably uneducated) decision