[Tutor] line class

Kent Johnson kent37 at tds.net
Tue Jul 8 12:25:57 CEST 2008


On Tue, Jul 8, 2008 at 4:01 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:

> def __init__(self,p1,p2):
>   self.p1 = p1
>   self.p2 = p2
>
> And since a line should not have zero length (although
> you might argue with that!) you could also check if
> p1==p2

In this case he should define Point.__cmp__() so the comparison is by
value rather than identity.

Kent


More information about the Tutor mailing list