proposed language change to int/int==float (was: PEP0238 lament)
Guido van Rossum
guido at python.org
Fri Jul 27 15:37:51 CEST 2001
rwallace at esatclear.ie (Russell Wallace) writes:
> You want the _type_ of the result to depend on the _value_ of the
> operands. My reaction to that is ***NO!!!*** It would make the
> division operator for integer operands so error prone as to be
> unusable. If that's the intent, much better to have it be an error to
> use integer operands, that way you wouldn't get silently and
> inconsistently wrong answers.
That all depends on details of the number system, and details of the
values involved. If we have rationals in our numeric tower, I
definitely want (5/2 - 3/2) to be usable as a sequence index, so
either rationals must be usable as sequence indices as long as their
value is integral, or the result of rational arithmetic may return an
int. That shouldn't matter.
On the other hand, floats should never be usable as sequence index.
Scheme defines this quite nicely:
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-list