Language change and code breaks

Dirck Blaskey dirck at pacbell.net
Thu Jul 12 03:07:59 EDT 2001


"Greg Ewing" <greg at cosc.canterbury.ac.nz> wrote in message
news:3B4D3622.5B4FC76E at cosc.canterbury.ac.nz...
> Dirck Blaskey wrote:
> >
> > 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*.
>
> That's only because the examples have deliberately
> been made very concise, to show the essence of
> what's going on.
>
> The problem occurs when / is applied to integer
> *objects*, which can arise from any number of
> sources.

The problem occurs when the programmer doesn't realize there is a problem,
not because of something fundamentally wrong with integer math.
It's a problem with expectations and the law of least astonishment.
Which audience would you rather astonish, and how much?

After I thought about it some more:
"of course the examples show literals,
 or they wouldn't be very good examples, would they?"
though I still assume this example:
        (x+y)**(1/2)
is verbatim.

Detecting and reporting the case for literals wouldn't break code,
and might provide enough help to some novice programmers so
they would realize this is something they have to be aware of,
and perhaps learn, and maybe even remember in the cases where they're
not using literals.  It is a burden.

"Might"+"some"+"perhaps"+"maybe" is far too vague for Guido's tastes.

Of course, it was just a thought, if not necessarily a good one.

d






More information about the Python-list mailing list