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

Christopher A. Craig com-nospam at ccraig.org
Sat Jul 28 19:14:23 EDT 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

> 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 don't like this.  If we accept PEP238 then I would like to see
the rational type return an int (preferably a united long/short int)
if the denominator is one.  Meaning that 5/2-3/2 would actually be an
int, and thus could be used as a sequence index.

- -- 
Christopher A. Craig <com-nospam at ccraig.org>
Often statistics are used as a drunken man uses lampposts -- for support
rather than illumination.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt

iEYEARECAAYFAjtjR04ACgkQjVztv3T8pzsXYgCcDirmNvyZJXZKlaeorpaVUQCP
3SwAnRF7OHdZPP6qSD7CPnmjx0b33Esg
=pFlW
-----END PGP SIGNATURE-----




More information about the Python-list mailing list