In your solution to vector you use Vector:
def __neg__(self):
return Vector(-x for x in self)
You also hardcode Vector in __add__.
Above it, though, in __getitem__ you get the class by using class(self). This seems inconsistent, and probably incorrect. If you were to subclass Vector, for instance, it would break when negating an instance of the subclass.
In your solution to vector you use
Vector:You also hardcode
Vectorin__add__.Above it, though, in
__getitem__you get the class by usingclass(self). This seems inconsistent, and probably incorrect. If you were to subclassVector, for instance, it would break when negating an instance of the subclass.