Language change and code breaks

pfenn at mmm.com pfenn at mmm.com
Thu Jul 12 13:17:01 EDT 2001


         Tom> I *always* forget the 1/3 == 0 thing between programming
bursts.
         Tom> OTOH, I also quickly remember after making the mistake the
first
         Tom> time.

     What is it that reminds you of the mistake?  Is it something glaring
like
     using the result of 1/3 as a divisor and getting a divide-by-zero
error, or
     is it something more subtle like getting slightly incorrect results
and
     having to dig through your code to find the problem?

     --
     Skip Montanaro (skip at pobox.com)

It's usually easy to find using the primitive tests I set up.  Typically,
data starts out as floating point, so this behavior won't cause incorrect
results.  Instead, I get incorrect graph labeling, etc.   However, this
issue is going to keep coming up as a problem because it's not what an
occasional user, even an experienced occasional user expects to happen,
particularly with a dynamically typed language like Python.   This is the
only point on which I consider Visual Basics behavior to be "better" than
Python's.

Is there really much code that depends on 1/3 == 0 being true?

Tom Fenn





More information about the Python-list mailing list