Comment on PEP-0238

Paul Prescod paulp at ActiveState.com
Mon Jul 2 10:36:36 EDT 2001


"Robert J. Harrison" wrote:
> 
>...
> The current coercion rules are simple, easy to grasp, and consistent
> with how most people are taught arithmetic.

That is simply not true. Most people do not expect these four
expressions to yield different results:

1.0/3.0
1/3
1.0/3
1/3.0

If you were taught this in school, it must be "new math".

>...
>   2) Integers should be treated as a distinct type from reals with
>      automatic coercion only as necessary (with the current rules).

What is "necessary"? Why is automatic coercion *ever* necessary? Only to
simulate the mathematics we are taught in primary school where the above
statement are all equivalent.

>      For instance, the new proposal sensibly does not suggest that lists
>      should support real indices,

	That might well be an implication of PEP 228.

http://python.sourceforge.net/peps/pep-0228.html

>  however simple expressions such
>      as a[i/3] would have to be coded as a[int(i/3)] or a[i//3]
>      in order to be sure to avoid a type error.

You mean that you would have to say exactly what you mean according to
the new syntax. That's hardly a legitimate argument against the syntax.
"If you add a 'function' keyword, I would have to precede my function
calls with it." Well, yeah, that's the point of adding new syntax.
-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list