Comment on PEP-0238

Guido van Rossum guido at python.org
Fri Jul 6 15:53:13 EDT 2001


Andrew Kuchling <akuchlin at mems-exchange.org> writes:

> Guido van Rossum <guido at python.org> writes:
> > 3. A revision later, we change all plain integer divisions to be an
> >    error, *forcing* folks to use div() or use the future statement to
> >    specify floating point division.
> 
> Step 3 strikes me as a bit odd; does that mean documentation for that
> release will have to say "applying the / operator to integers is an
> error, full stop"?  And then in the next release the docs will again
> have to be changed to say that integer division now works?  IMHO step
> 3 should be dropped; one release with a warning every time integer
> division is attempted should be sufficient.

Possibly.  But it means that folks who skip just one release are in
for a nasty surprise.  I'd like that to be two releases.  Maybe we can
just hang on to the warning for two releases.

> >   from __future__ import float_division
> >   from __future__ import real_division
> >   from __future__ import new_division
> >   from __future__ import division
> 
> 'float_division'.  There's no type corresponding to "real", nor is
> that terminology used anywhere in the docs; 'new_division' and
> 'division' strike me as unclear.

I would pick float_division in a jiffy if it weren't for the issue
that some folks feel that they would rather have 1/3 return a rational
number.  I think they'll lose that argument in the end, but I don't
want to preclude that outcome just yet.  I like the proposal
unified_division best so far, with float_division a close second.

> I still like 'x div 3' better than div() or //, but can live with div().

I like x div 3 better too, but it means adding another new keyword,
and I'd rather not do that.  Picking div() means that we can still
turn that into a keyword later (the keyword would be both a unary and
a binary operator).

> > Unfortunately, the number of potential Python programmers who will be
> > frustrated by the current integer division is much larger than the
> > number of established Python programmers.  
> 
> I'm still unconvinced about that, though.  Like the occasional claims
> that there would be many more Python users if more conventional block
> delimiters are used, this strikes me as proof by assertion.

But that's not what I said!  I don't think that this will affect the
number of users.  Rather, I expect that we'll be flooded with users
for whom float division is more natural than integer division: the
CP4E crowds.  They'll come anyway, but they'll be happier with a
language that has float division.

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



More information about the Python-list mailing list