Closed rasmunk closed 4 years ago
https://github.com/rasmunk/docker-migrid/blob/9b8b092f1eb1d7117088a19fe8e0a48bd740fcd4/mig/shared/pattern.py#L16
When you wan't to do an equality check between instances of the same object type, you should implement it via the so called "rich comparison" methods as per https://docs.python.org/2/reference/datamodel.html#object.__eq__
An example can be seen here https://devinpractice.com/2016/11/29/python-objects-comparison/
This then allows for the direct comparisons checks, e.g:
(self.__eq__) pattern1 == pattern2
(self.__eq__)
pattern1 == pattern2
(self.__ne__) pattern1 != pattern2
(self.__ne__)
pattern1 != pattern2
As per the refactor this is no longer an issue
https://github.com/rasmunk/docker-migrid/blob/9b8b092f1eb1d7117088a19fe8e0a48bd740fcd4/mig/shared/pattern.py#L16
When you wan't to do an equality check between instances of the same object type, you should implement it via the so called "rich comparison" methods as per https://docs.python.org/2/reference/datamodel.html#object.__eq__
An example can be seen here https://devinpractice.com/2016/11/29/python-objects-comparison/
This then allows for the direct comparisons checks, e.g:
(self.__eq__)
pattern1 == pattern2
(self.__ne__)
pattern1 != pattern2