A bug I found in Python

Jp Calderone exarkun at intarweb.us
Sat Mar 29 12:41:34 EST 2003


  I have used Python for many minutes now, but I have recently discovered
some surprising behavior!

  When I attempt to add two integers together, the result is a third,
different integer!

  Here is an example of this surprising behavior:

      def biffle_buffle_bam(x, y):
          z = 10
          print 'Hello world'
          return anotherFunctionIWrote(x, y)

      print biffle_bam_baffle(10, -10)

  As you can clearly see, when this is run, 0 is printed out!  I think this
is very surprising behavior, since I did not type 0 into my program at all,
only 10 and -10.

  Maybe this is documented somewhere, but I am too busy adding integers
together by hand to look up the answer.  Maybe if Python were less
surprising I would not have to do this!

  Can anyone explain why this design flaw was placed into Python?

  Jp

-- 
No, `Eureka' is Greek for `This bath is too hot.'
                -- Dr. Who
-- 
 up 9 days, 14:00, 5 users, load average: 1.02, 0.97, 0.75





More information about the Python-list mailing list