I have a vector class which gives a vector with a list and I need to be able to add vectors or vectors to lists, tuples, and strings. If they are not of the same length, I need to throw a type error. Some examples of output:
Vector([6,8,2])+Vector([4,-3,2])
Vector([10, 5, 4])
>>> Vector([6,8,2])+[4,-3,2]
Vector([10, 5, 4])
>>> (6,8,2)+Vector([4,-3,2])
Vector([10, 5, 4])
>>> v=Vector(["f","b"])
>>> v+=("oo","oo")
>>> v
Vector(['foo', 'boo'])
I need to make a + function and a += function.
Which python methods do I use to override the + and += operations, also I need to make sure that my + operation works on an object and a sequence and the reverse