[Python-Dev] int division proposal in idle-dev

Guido van Rossum guido@python.org
Mon, 10 Apr 2000 11:16:58 -0400


David Scherer posted an interesting proposal to the idle-dev list for
dealing with the incompatibility issues around int division.  Bruce
Sherwood also posted an interesting discussion there on how to deal
with incompatibilities in general (culminating in a recommendation of
David's solution).

In brief, David abuses the "global" statement at the module level to
implement a pragma.  Not ideal, but kind of cute and backwards
compatible -- this can be added to Python 1.5 or even 1.4 code without
breaking!  He proposes that you put "global olddivision" at the top of
any file that relies on int/int yielding an int; a newer Python can
then default to new division semantics.  (He does this by generating a
different opcode, which is also smart.)

It's time to start thinking about a transition path -- Bruce's
discussion and David's proposal are a fine starting point, I think.

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