def __ge__(self, other): """ >>> s=array(["this ", "thar", "other"]) >>> t=array(["this", "that", "another"]) >>> s.__ge__(t) array([1, 0, 1], type=Bool) """ return _chararray.StrCmp(self, 5, self._is_raw, other)
def __eq__(self, other): """ >>> array(["this ", "thar", "other"]).__eq__(array(["this", "that", "another"])) array([1, 0, 0], type=Bool) >>> array([""]).__eq__(array([""])) array([1], type=Bool) >>> array([""]).__eq__(array(["x"])) array([0], type=Bool) >>> array(["x"]).__eq__(array([""])) array([0], type=Bool) >>> a = array(["this"]*10) >>> a == a # compare to self array([1, 1, 1, 1, 1, 1, 1, 1, 1, 1], type=Bool) """ return _chararray.StrCmp(self, 0, self._is_raw, other)
def _StrCmp(self, mode, raw, other0): """StrCmp(self, other0) calls strncmp on corresponding items of the two numarray, self and other. """ if not isinstance(other0, self.__class__): other = asarray(other0, padc=self._padc, kind=self.__class__) else: other = other0 if self._shape != other._shape: self, other = self._dualbroadcast(other) if self._itemsize < other._itemsize: self = self.resized(other._itemsize) elif other._itemsize < self._itemsize: other = other.resized(self._itemsize) if self is None: raise ValueError("Incompatible array dimensions") return _chararray.StrCmp(self, mode, raw, other)