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

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sat Jul 28 03:55:47 EDT 2001


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.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list