Language change and code breaks

Dirck Blaskey dirck at pacbell.net
Wed Jul 11 14:47:17 EDT 2001


"Guido van Rossum" <guido at python.org> wrote in message
news:cplmlvh6dx.fsf at cj20424-a.reston1.va.home.com...
> Very good sumary, Terry.  I'm beginning to get second thoughts about
> integer division -- maybe it's better to leave well enough alone, and
> try to fix areas of the language that could really stand some fixing
> (such as subclassing built-in types).
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)

Glad you're having second thoughts, I'm on my third or fourth.
At one point you even had me convinced, but then...
to someone maintaining a large code base, dealing with
a change this subtle could be somewhere between 'intimidating'
and 'terrifying', especially since there are no type declarations.

I don't think I agree with the spirit of PEP 228, either.
Hardware is a fact of life.

Anyway, Just another point to consider:

In all the examples cited that show why this is a problem,
it's not integer division that causes the confusion,
it's division of integer *literals*.  Anyone using literal '1/2'
in a program has probably made a mistake.  I don't know how smart the
compiler is in pre-processing constant expressions, but if it is,
it could be smart enough to issue warnings for constant integer division
yielding quotient == 0  or remainder != 0.

Just a thought.

d






More information about the Python-list mailing list