proposed language change to int/int==float (was: PEP0238 lament)
Skip Montanaro
skip at pobox.com
Tue Jul 24 14:15:05 EDT 2001
Marcin> The behavior of ** depends on the exponent which determines the
Marcin> narrowest type to which base is converted first.... If it's a
Marcin> rational or float, the base is converted from int or rational to
Marcin> float.
Hmm... PEP 240 proposes that numbers matching the regular expression
'\d*.\d*' be interpreted as rationals. Thus "0.5" would be interpreted as
the rational "5/10" (or perhaps reduced to "1/2"). Using this definition of
rational literal and your coercion semantics, "4**0.5" would yield a float
instead of an integer or rational. Why shouldn't an integer or rational
base be converted to a rational if the exponent is a rational?
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/
More information about the Python-list
mailing list