What Im not sure about is what methods I need to use to compare the vectors. I tried googling it but couldn’t find anything. Does python have some methods to override < > <= and so on?
Yes, Python has magic methods which are exactly for this purpose. You’re already using magic methods, such as __len__
, __iter__
, etc. Here‘s a good link for the comparison magic methods, you’re particularly looking for:
__eq__
= equal to (==
)__ne__
= not equal to (!=
)__lt__
= less than (<
)__le__
= less than or equal to (<=
)__gt__
= greater than (>
)__ge__
= greater than or equal to (>=
)
solved Python Object Comparisons