I would say, though, that you should be careful in your implementation of
is_on_line, for floating point round-off errors.  Try this at the command
prompt (Python 2.5.2, with __future__ division imported):

>>> 49 * (1/49) == 1
False
>>> 1 - 49 * (1/49)
1.1102230246251565e-016

I would suggest a slightly modified version of is_on_line:

class Line(object):
     EPSILON = 1e-15
     ...

     def is_on_line(self,(x,y)):
         'Test if point represtented by an (x,y) tuple is on the line'
         return abs(self. m * x + self.c - y) < Line.EPSILON

-- Paul


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to