proposed language change to int/int==float (was: PEP0238 lament)

Guido van Rossum guido at
Thu Jul 26 17:18:38 EDT 2001

> >> >The important thing is that i//j will return the same value
> >> >regardless if i and j ar ints or floats; ditto for the new i/j.

> >> If that's important, why won't the other math operators do it???

> >Huh?  They do (apart from unavoidable round-off errors).  1+2 == 1.0+2.0.

> They compare equal with the "==" operator, but they are not
> the same value:
> >>> 1+2
> 3
> >>> 1.0+2.0
> 3.0
> >>> 
> ... unless 3 and 3.0 are "the same value".  In which case my
> definition of that phrase is merely different than yours.

Well, they have the same *mathemtical* value, and Python does its
darndest to treat them as equal everywhere.  For example, a dict with
int keys can be indexed with corresponding float or complex values.
Exceptions are operations that intrinsically require ints, e.g. list
indexing.  (This would change under a unified numeric system though, I
expect, unless inexact numbers are excluded from being used as
sequence indices.)

--Guido van Rossum (home page:

More information about the Python-list mailing list