I want to define a point, then define an array of three points as a class. Given the definition below, I can do this and it works:
a = [POINT(0,0) for i in range(4)]
but I want to be able to do this:
a = THREEPOINTS()
and then do this:
a[2].x = 7
a[2].y = 3
My attempt is below but it doesn't work. Is there a way to define a class that is an array?
class POINT:
def __init__(self, x, y):
self.x = x
self.y = y
class THREEPOINTS:
def __init__(self):
self = [POINT(0,0) for i in range(4)]