object oriented programming basics (python) <p>Level: Beginner</p> <p>In the following code my 'samePoint' function returns False where i am expecting True. Any hints?</p> <pre><code>import math class cPoint: def __init__(self,x,y): self.x = x self.y = y self.radius = math.sqrt(self.x*self.x + self.y*self.y) self.angle = math.atan2(self.y,self.x) def cartesian(self): return (self.x, self.y) def polar(self): return (self.radius, self.angle) class pPoint: def __init__(self,r,a): self.radius = r self.angle = a self.x = r * math.cos(a) self.y = r * math.sin(a) def cartesian(self): return (self.x, self.y) def polar(self): return (self.radius, self.angle) def samePoint(p, q): return (p.cartesian == q.cartesian) &gt;&gt;&gt; p = cPoint(1.0000000000000002, 2.0) &gt;&gt;&gt; q = pPoint(2.23606797749979, 1.1071487177940904) &gt;&gt;&gt; p.cartesian() (1.0000000000000002, 2.0) &gt;&gt;&gt; q.cartesian() (1.0000000000000002, 2.0) &gt;&gt;&gt; samePoint(p, q) False &gt;&gt;&gt; </code></pre> <p>source: MIT OpenCourseWare <a href="http://ocw.mit.edu" rel="nofollow">http://ocw.mit.edu</a> Introduction to Computer Science and Programming Fall 2008</p>