> def length(self): > dx,dy = self.p1 - self.p2 > return (dx**2 + dy **2) ** 0.5
How about:
def length(self):
return math.hypot( *(self.p1 - self.p2) )
Compiled C code will be much faster than squaring and square rooting.
-- Paul
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor
