Comment on PEP-0238

Terry Reedy tjreedy at home.com
Sat Jul 7 16:31:18 EDT 2001


> Indeed, the beauty of binary operators is that they help the human
> programmer quickly understand an expression

Yes, indeed.
...
> The proposal of "//" got a lot of opposition from folks who are
> concerned that it would confuse people with a C++ or Java background
> too much, because it's a comment there.

I can see that now (I don't program in either)

> The "div" keyword would be ideal except for the added complexity of
> adding a new keyword to the language

While adding one (yield), another won't hurt much, since a program to
search for conflicts with names and make replacements in a collection of
files could easily do both in the same two passes.  (Two passes are needed
so that the replacement for variable 'yield' or 'div' does not conflict
with another existing variable such as 'yields' or 'divx'.)

Another *STRONG* argument for replacing int / with another infix operator
is the feasibility of revising the thousands of broken lines of code to run
under 2.whatever.  Any decent programming editor can do a 'find / and
replace with xxx if I say yes' (which will require the reviser to examine
the code to determine if / meant int div) but hardly any can do 'find / and
examine the code on both sides to determine the strings that the
interpreter will see as e1 and e2 and replace e1 / e2 with div(e1,e2) if I
say yes'.  Writing a special purpose update program would also be much
easier.

>-- do we need a separate warning  phase here, too?

Maybe yes, in parallel with / warnings.  Maybe no, depending on what do
with yield.  I think it more important to make it as easy as possible to
fix broken lines, whenever that does become necessary.

Terry J. Reedy








More information about the Python-list mailing list