Hurray for new division!!!

Chris Barker Chris.Barker at noaa.gov
Thu Jul 18 12:56:16 EDT 2002


Hi all,

After all the contentiousness about new division, I thought I'd post
this little anecdote.

I just spent quite a few hours debugging an error caused by using
integer division when I didn't expect it (Python 2.1, with "old"
division). It was caused by a piece of test code I wrote to compare the
results of two different algorithms used in a C extension. The results
should have been the same, and they weren't. The bug turns out to have
been caused by integer division of two numbers, one of which should have
been a Float, but in my test code I just just quickly hard coded in an
easy constant that happened to be an integer, and got wrong results. It
took me forever to find the problem! With new division there would have
been no problem. This just reinforced the idea that the behavior of the
division operator (or any operator) should not be a function of the type
of operator (when the types are so similar) in a dynamic language.

I am not a Newbie. I have been using various programming languages for
over 20 years (if you count Basic on an 8k Commodore PET). I have been
using Python pretty regularly for over 3 years. I am very much looking
forward to new division being standard.

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer
                                    		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov



More information about the Python-list mailing list