PEP0238 lament

Martijn Faassen m.faassen at vet.uu.nl
Sun Jul 22 23:14:36 CEST 2001


Tim Peters <tim.one at home.com> wrote:
> [Arthur_Siegel at rsmi.com]
>> ...
>> If I was told that experinced programmers might
>> appreciate this change for any possible reason -
>> I'd be quiet as a mouse.

> 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.

> It shouldn't be so hard to understand why.
[snip Tim's reasons]

The audience was entirely self-selected; they were people with an interest
in numeric models. Did Guido ask for a show of hands in the big session
afterwards? I don't recall; I kind of suspect the outcome would've been
different.

> The current integer division
> loses information silently and without a trace.  Combined with that Python
> is not a statically typed language, there's simply no telling what e.g.

> def velocity(distance, time):
>    return distance / time

> will compute by inspection. 

There's no telling what:

def add_stuff(a, b):
   return a + b

will compute by inspection either, though. Are we complaining about that? 
(yeah, I know the inverse operation is rather hard to define for
string addition :)

[snip]

Of course I claim no expertise in this matter whatsoever. :)
For working with pixels in GUIs and such, integer division can be a useful
thing, though.

Regards,

Martijn
-- 
History of the 20th Century: WW1, WW2, WW3?
No, WWW -- Could we be going in the right direction?



More information about the Python-list mailing list