A use for integer quotients

Tim Daneliuk tundra at tundraware.com
Mon Jul 23 13:00:01 EDT 2001


Moshe Zadka wrote:
> 
> On Sun, 22 Jul 2001 23:42:03 -0700, Erik Max Francis <max at alcyone.com> wrote:
> 
> > Or you could not change it in the first place, eliminate the transition
> > period requirement, keep Python's integer division operator consistent
> > with other languages
> 
> non-issue. Many other languages do division correctly - Scheme, Perl and
> Tcl, for instance.
> 

I've been watching this debate with some interest, hoping that NO change
be instituted.  That is, 3/4 should return 0 as it does today.  'Just
a few points:

- This is not "incorrect" arithmetic.  *It is 3/4 == .75 that is incorrect*
  because the precision of the result exceeds the precision of the operands.
  This path has been paved to hell for several thousand years and ought
  not to be trod upon once again - we should know better.

- If anything, the new // operator ought to apply to new behavior, not be
  foisted upon existing code.  If people desparately want integer division to
  return floating point results, then the onus should be on them to use a
  new operator. 

- As I understand it, a significant motivation for this action has to
  do with making the language more accessible to beginners.  This is a
  laudable goal, but it ought not take precedence over mathematical 
  correctness.  We've all seen and used any number of languages that
  made "learning" and "accessibility" the goal and the result has been
  a code maintenance nightmare.  Examples include many early variants
  of BASIC (after the original Dartmouth version), almost all of the
  4-GLs like FOCUS, and so on.  I am by no means an advocate of 
  preserving the programming High Priesthood.  Making languages easier
  to assimilate *is* important.  However, if the cost of doing so is
  to violate the canons a mathematics, produce unmaintainable code, or
  perpetuate bad professional practice, we ought not to do it.  

So, here's one strong vote for leaving things along, or at the very least,
introducing nw behavior with new operands.

------------------------------------------------------------------------------
Tim Daneliuk
tundra at tundraware.com



More information about the Python-list mailing list