import math
class Circle(object):
def __init__(this,x,y,rad):
this.x=x
this.y=y
this.rad=rad
def relate(circ1,circ2):
diff=__posDiff((circ1.x,circ1.y),(circ2.x,circ2.y))
print diff
def __posDiff(p1,p2):
diff=math.sqrt((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2)
return diff
when I try to run the above code I get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Circle.py", line 18, in relate
diff=__posDiff((circ1.x,circ1.y),(circ2.x,circ2.y))
NameError: global name '_Circle__posDiff' is not defined
Quite new to python, cant figure out how to call the function inside class.If anyone can help and explain