[Edu-sig] re: More spillover re the division PEP

Dustin Mitchell dustin@cs.uchicago.edu
Sun, 29 Jul 2001 11:12:28 -0500 (CDT)


I hate to continue this thread, but I have a point I haven't seen yet:

Ask a grade-school student who is at the point where she can divide
integers, but hasn't learned about fractions or decimals, "What's 10
divided by 3?"  She will answer, "3".  Students initially learn division
as a lossy operator, and only later (though not much later) learn that it
can do more. Student's don't learn that this 'lossiness' is wrong -- they
learn that it is one sense of division; one that is useful for long
division and writing mixed fractions, for example.

Similarly, those learning Python should learn the 'lossy' operator first,
and should learn that the 'lossy' behavior is useful in many situations.  
They should learn about the 'lossless' form of division shortly
thereafter, learn why they both exist, and learn that even 'lossless'
division loses something on a computer.

I agree that the current notation for 'lossless' division is clumsy and
non-intuitive.

I feel that changing the semantics of an existing operator will cause more
compatibility problems[1] than adding a new operator with new semantics.

So, if I were king of my own little universe, Python would get a new '//'
operator which does 'lossless' division, and the '/' operator would retain
its original semantics.  'course, I'm no king. :-)

Dustin

[1] Note there are two flavors of compatibility problems: old scripts on a
new interpreter, and new scripts on an old interpreter.  To maximize
usability of the language, both combinations are important.

  )O(