def _compare(self, other, method):
<EOL>if isinstance(other, abc_mapping_primitives.Coordinate):<EOL><INDENT>if self.get_dimensions() != other.get_dimensions():<EOL><INDENT>return False<EOL><DEDENT>other_values = other.get_values()<EOL>for index in range(self._dimensions):<EOL><INDENT>if not method(self._values[index], other_values[index]):<EOL><INDENT>return False<EOL><DEDENT><DEDENT>return True<EOL><DEDENT>return NotImplemented<EOL>
see https://regebro.wordpress.com/2010/12/13/python-implementing-rich-comparison-the-correct-way/