A use for integer quotients

Duncan Grisby dgrisby at uk.research.att.com
Wed Jul 25 05:43:45 EDT 2001


In article <cpae1tboxg.fsf at cj20424-a.reston1.va.home.com>,
 Guido van Rossum  <guido at python.org> wrote:

>Well, so far the only arguments I've heard come down to
>
>(1) int/int *ought* to return an int;
>
>(2) it breaks too much code to change now.

What about

(3) it makes it extremely painful to write new code which works with
    both old and new versions of Python.

It seems only prudent that any Python code I write now should avoid
using / for integer division, just as I should avoid using yield as an
identifier. If I need integer division, I'm stuck with divmod()[0].

Note that it won't be possible to write cross version code which does
integer division until Python 2.1 is as rare as 1.4 is now. I'd say
five years at least before it's possible to use integer division with
an operator again.

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --



More information about the Python-list mailing list