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.