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

Guido van Rossum guido at python.org
Sat Jul 28 18:10:23 EDT 2001


Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> writes:

> Fri, 27 Jul 2001 13:37:51 GMT, Guido van Rossum <guido at python.org> pisze:
> 
> > If we have rationals in our numeric tower, I definitely want (5/2 - 3/2)
> > to be usable as a sequence index,
> 
> This doesn't work in my model. The simplest way to let it work is to
> treat ints (with longs) and rationals as representation details of
> the same concept (no matter if it's the same Python's type or not).
> 
> This is not nice IMHO and it leads to more cases when the type of the
> result depends on the value of the argument (x**y returns at least
> a float when y is a rational, but may return an integer when y is
> a nonnegative integer) and turns some TypeErrors into ValueErrors
> (e.g. s[1/2]).
> 
> I would not make 5/2-3/2 usable as a sequence index. My style is more
> "typeful". But you decide.

I am not at all sure!  This should definitely be added as an open
issue to the rationals PEP.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list