Steven D'Aprano <[EMAIL PROTECTED]> writes:
> When it comes to mixed arithmetic, it's just too darn inconvenient to 
> forbid automatic conversions. Otherwise you end up either forbidding 
> things like 1 + 1.0 on the basis that it isn't clear whether the 
> programmer wants an int result or a float result,

You can parse 1 as either an integer or a floating 1, so 1 + 1.0 can
be correctly typed as a float.  However (for example), len(x) is
always an int so len(x) + 1.0 would be forbidden.

> or else even more complex rules ("if the left operator is an int,
> and the result of the addition has a zero floating-point part, then
> the result is an int,

That is ugly and unnecessary.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to