This is what I'm working with:
class Vector:
def __init__(self):
self.x = 0
self.y = 0
self.z = 0
self.w = 0
self.data = [
[self.x],
[self.y],
[self.z],
[self.w]
]
Is it possible to update self.data any time another attribute changes?
I know I could just write an update function for it like:
def update(self):
self.data = [
[self.x],
[self.y],
[self.z],
[self.w]
]
but I would rather not call v.update() 60 times/second.
I also know that I could just not use other attributes and update the list indices by doing v.data[0] = 5, but it would be nice to do v.x = 5 for readability (v is an instance of Vector).
For now I'm just biting the v.data[0] = 5 bullet...
Edit: Data is a list of lists for matrix multiplication.