[Python-Dev] Comparing heterogeneous types
Armin Rigo
arigo at tunes.org
Wed Jun 23 06:15:33 EDT 2004
Hello Guido,
On Tue, Jun 22, 2004 at 10:49:51PM -0700, Guido van Rossum wrote:
> (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.)
Well, just for quick consideration (and probably rejection :-) :
If "a <= b" is to mean we convert a and b to either float or long depending on
their magnitude, would it make any sense at all if other operators like "a +
b" would do the same, to maximize precision?
>>> 1L + 0.5
1.5
>>> L = 100000000000000000000000L
>>> float(L)
9.9999999999999992e+22
>>> float(L+1)
9.9999999999999992e+22
>>> L + 1.0
9.9999999999999992e+22 # currently
100000000000000000000001L # suggested
Armin
More information about the Python-Dev
mailing list