PEP0238 lament
John W. Baxter
jwbaxter at spamcop.com
Sun Jul 22 23:39:32 EDT 2001
In article <mailman.995826216.11537.python-list at python.org>, Tim Peters
<tim.one at home.com> wrote:
> Not all experienced programmers agree. At the last Python Conference, I
> moderated a 40-some person group discussion on conceivable changes to
> Python's numeric model, not advocating but keeping the participants from
> killing each other <wink>. The meaning of integer division wasn't the
> focus, but naturally came up. By show of hands, about 3/4ths of the
> participants agreed that 3/4 should not return 0, but rather *something* x
> such that x*4 had a better chance of being confused with 3 than with 0.
> There was no consensus on exactly what 3/4 should return -- rational or HW
> float or decimal float were the most popular alternatives.
I see a fairly strong argument there for starting out with a language
in which int / int --> float (or rational) and int // int --> int (or
int div int --> int).
I don't see it as a strong enough argument to overcome the fact that
the careful programmer will have to inspect every / in all the code,
before installing 2.3 or whatever version this happens in, to see
whether (a) it IS division, as opposed to the / in
'<a href="6/7.html">' (that's contrived...but possible) and if so
whether it has to be respelt as // (or div).
Some of them will; some won't: some of both outcomes indicate latent
errors in the code, so the inspection isn't completely wasted after
all.
And it may not be her code...she could be 3 or 4 people removed from
the creator, who is gone. [Another good thing about finding the latent
errors.]
It's true--as stated elsewhere--that Guido hears all the complaints.
It's also true that until recently there was no reason for Guido to
hear "Guido, thank you for defining int / int to be integer division,
because integer division is natural for my problem space." So he's
been getting a biased sample. Probably a fairly representative one
even so.
--John
More information about the Python-list
mailing list