PEP0238 lament

Stephen Horne steve at lurking.demon.co.uk
Mon Jul 23 02:39:07 EDT 2001


On Sun, 22 Jul 2001 16:22:54 GMT, Guido van Rossum <guido at python.org>
wrote:

>discussed many times before.  The summary of the argument in the PEP
>may not be complete, but I disagree with Arthur's assessment that
>integer division is not a problem -- the VPython folks have ample
>experience that it is.

The PEP says virtually nothing. It simply claims that 1/2 giving 0
creates a hump in the learning curve. The only questions answered are
the ones about not creating a div keyword or function - which I don't
believe anyone is contesting.

The bit about coercing to floats rarely if ever happens - if you are
dealing with float values then that is most likely what the variables
you are using hold. If you need a float literal, all it needs is to be
written as a float - simple, clear and it works.

I doubt that anyone ever got through school without learning about
integer division and remainders - most children learn that before they
learn long division, let alone fractions and decimals, so all they
should need is a reminder.

People only experience their first day of something new *once*.
Really, this cannot be considered a problem. A five minute explanation
- if that - says all that needs to be said. Hell - even my mum
understands integer division, and she regularly confuses the size of
her machines RAM and hard disk!

Integer division is claimed to be a major stumbling block in user
testing - what does that mean exactly? Has formal user testing been
done? Just how confused were people? Were these the same people who
tried to put full stops and the end of their 'scentences'? Do you
simply count the frequency that a question is asked, or do you make an
allowance for how easily it is sorted out? Have you done *any* user
testing with the alternate implementation?

As for a few professional programmers occasionally making mistakes -
surely that means the vast majority get it right most of the time,
which suggests the current version is correct. There is a good chance
that those from Pascal and Modula 2 backgrounds who've rarely if ever
used other languages might be temporarily confused, and might get
things wrong a while after from force of habit. But what about all
those from C, C++, Java, Ada, BASIC - and don't forget, Visual BASIC
has been the most popular professional programming language for
several years - not to mention the VBScript and JavaScript used by all
those web developers, and even VBA in Microsoft Excel.

Pascal is a half dead language. It is currently achieving significant
success only as Delphi - a non-standard, single-vendor implementation
that - despite being a commercial product - has to be given away free
on magazine CD ROMs in order to keep people using it. Is that what we
want to emulate?

Surely the professional programmers who expect 1/2==0.5 are a
minority.

Look at all the algorithms that *require* integer division to give an
integer result - anyone who has so much as binary searched an ordered
list or tuple is going to have *BIG* problems.

>Because all Arthur does is tick me off, I'll leave it at this -- maybe
>someone else can explain it all to him.

I have no idea about Arthur, but the PEP explains virtually nothing
about the reasons and the idea that it will actually be done scares
the hell out of me. After the time I spent convincing my employer to
let me use Python internally, you now want me to throw away all the
productivity gains and more trying to sort out the results of this
change - *and* you want me to explain it to my boss! Maybe a slightly
better reason is needed than 'newbies are often a bit confused for
five minutes or so'.

I don't remember ever contributing to threads on this topic before - I
just kind of assumed the idea was laughable on those occasions when
I've seen it, and I expect I usually missed it because I only
occasionally follow the group. I'll bet there are a lot of people like
me who never really believed this would happen, and are going to go
ballistic if it does.

If we can't rely on a fundamental operator to work the same from one
release to the next, then Python is going to be reduced to a joke. It
is going to be causing surprise bugs for years to come as people
upgrade there old 1.5.2 installations - many times, the programmer
will have since left the company and there won't be anyone there to
fix it. Just think of the impact that will have on Pythons reputation.

If there really needs to be a division operator that returns floats
with all-integer arguments, *that* is the new functionality and *that*
should be the new operator. The idea of a division operator that
returns an integer when given float arguments is just plain daft, so
the existing division operator works fine for integers whatever
viewpoint anyone takes.

If this is about people in the pro-PEP0238 camp not wanting to have to
use // for their precious operator - why the hell should it be forced
on the anti-PEP0238 camp?




More information about the Python-list mailing list