[Python-Dev] Comparing heterogeneous types
ark-mlist at att.net
Thu Jun 24 11:29:11 EDT 2004
> (For other operations, I still want to see e.g. long+float to return a
> float rather than a long -- you *have* to do it this way for obvious
> reasons when the values are relatively small, e.g. consider 1 + 0.5.)
That is not unreasonable behavior. However, I wonder if it might be
possible to do better by yielding a long in those cases where the value is
so large that the LSB of a float would be >=1. By doing so, it might be
possible to guarantee that no precision is needlessly lost--analogously to
having the result of int addition yield a long when an int cannot contain
the result exactly.
Please understand that I am not advocating this strategy for arithmetic the
way I am for comparison, because I am not sure about its formal properties.
I'm going to think about it for a while; depending on my conclusions, I may
change my opinion later.
More information about the Python-Dev