I read multiple article about OOP in python but I didn't find the answer. here is my sample code as a example :
class Point(object):
"""basic point"""
def __init__(self, x, y):
self.x = x
self.y = y
class Circle(object):
"""basic circle object"""
def __init__(self,center,radius):
self.center = center #should be a point object
self.radius = radius
coord = Point(1, 2)
a = Circle(coord, 4)
b = Circle(4, 5)
If I understand correctly this is valid python code but the circle "b" doesn't have a Point object as the center. if there is a method in the circle object who use the center object to do a calculation (to calculate the circle's area for example) it will fail for the b object. Do I have to enforce type or is it the programmer responsibility to give a expected object type at the instantiation?