PEP0238 lament

Guido van Rossum guido at python.org
Mon Jul 23 07:07:49 EDT 2001


"Terry Reedy" <tjreedy at home.com> writes:

> >and nobody has ever proposed taking away the ability to get an
> >integer result; the issue is how  to spell that.
> 
> And that issue was *not* spelled out in the PEP.

Funny, I just checked rev. 1.1 of PEP 238, and it contains the same
language about adding // as before.  Maybe you never saw the PEP, but
assumed the worse based on the discussion?

> Actually, as I mention in my article today 'A use for integer
> quotients', I thought that one version of the proposal *was* to take
> away the current spelling without providing any replacement.  That is
> what I argued most strenously against.

This was never considered.

> I know that one version of the proposal was to provide an
> *unacceptible* (to me) replacement -- div(i,j).  Guido appeared to
> maybe even favor it until I pointed out that an infix replacement
> would make fixing current code *much* easier.

I originally favored //, but in an earlier round of discussions this
was opposed by folks based on its use for Java and C++ comments, so
for a while I considered alternatives.  Not any more.

> This gets to the issue of what is a proper PEP.  Simply saying 'I
> don't like the current situation; lets replace it with something' is
> not, in my opinion.  The only thing definite that I remember from
> reading PEP 238 was to change the result of int/int to float.  Then
> maybe add div() [awful], div [possible], // [best in my opinion],
> something else [???], or, at least by implication, nothing
> [horrendous].

You must misremember it.

> It is hard compare something definite (the current
> situation, whatever it is) to a nebulosity, especially when the range
> of alternatives floating around the nebula range from horrendous to
> maybe ok.

I find that most arguments against also appear to come from a nebula.

> If 238 had been written originally something like the following (which
> it now is), I would have argued *much* less.

Shall I rub it in? :-)  Your bad reading skills (or bad memory) cost
you a great deal of stress. :-)

> Situation: Python '/' currently overloads and confounds two arithmetic
> operations: whole-number result division and fractional result
> division.  This confuses some people.
> Proposal: Make '/' consistently mean fractional division and introduce
> a new operator '//' for truncated-result division.
> Acknowledgement: This semantic replacement is a bit different from
> most any previous change to Python.  Extra care will be needed to make
> the transition as smooth as possible.

This is exactly what the PEP said all the time.

> (Just noticed:  http://python.sourceforge.net/peps/pep-0238.html
> now proposes a *2 year* int/int warning period starting with 2.3.  It
> still needs a stipulation that someone write an intdiv checker to help
> automate replacements.)

Hm???  I don't see that on the URL you give.  Maybe you live in an
alternate universe where PEP 238 has a different contents than in mine?

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list