class Point:
def __init__(self,x,y):
self.x = x
self.y = y
class Rect:
def __init__(self,lefttop_point,rightbottom_point):
self.lefttop = lefttop_point
self.rightbottom = rightbottom_point
def __contains__(self,y):
if self.lefttop.x<=y.x<=self.rightbottom.x and self.lefttop.y<=y.y<=self.rightbottom.y:
return True
else:
return False
rectA = Rect(Point(10,10),Point(20,5))
print(Point(15,18) in rectA)