[Python-Dev] Integer division transition

Guido van Rossum guido@python.org
Mon, 06 Nov 2000 12:17:22 -0500


> [Guido]:
> > David Scherer proposed to spell this pragma as a "magical import"
> > (http://www.python.org/pipermail/idle-dev/2000-April/000138.html). 

[Peter Funk]
> Huh?  AFAIR David Scherer and Bruce Sherwood used the 'global'-statement 
> at module level as a backward compatible method to introduce module level
> pragmas.  (http://www.python.org/pipermail/idle-dev/2000-April/000140.html)
> I still like David Scherers proposal very much.

Oops, you're right.  That URL mentions "global olddivision".  The
"import floatdivision" proposal came from a more recent private mail
from Bruce Sherwood.  I maintain that neither seems the right way to
spell "directive".  I think "import" is slightly better if the import
is supposed to enable a feature that is not supported by previous
versions, because the import will cause a clear failure on systems
that don't have the new feature (rather than silently giving wrong
results sometimes).

> BTW:  I think the "symbol" '//' is incredible ugly and starting with
> IBMs JCL years ago all languages I encountered, that used this symbol
> for something, did suck in some way or another.  I would appreaciate
> very much, if it could be avoided alltogether to add a symbol '//'
> to Python.  '//' will look like a comment delimiter to most people today.

Good point.  I've just used // as a placeholder for a new way to spell
integer division.

> Using a new keyword like 'div' in the tradition of languages like 
> Modula-2 looks far more attractive to me.

That's a possibility too.  It's a new keyword though, which has a much
higher threshold for acceptance than a new two-character operator
symbol.  We could spell it as a built-in function: div(a, b),
(analogous to divmod(a, b)) but that's not very user-friendly either.

Keep looking...

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