diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-04-14 17:38:11 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-04-14 17:38:11 +0000 |
commit | 5567185f1bbe1f568c2bcbaeb34ea8df84e83610 (patch) | |
tree | 4ab9f997707c58a3a366d7431c8b4098ca429515 /numpy/core/defchararray.py | |
parent | 036d7a3724a89d880339c89a1aff171d7e4c1e10 (diff) | |
download | numpy-5567185f1bbe1f568c2bcbaeb34ea8df84e83610.tar.gz |
Add string (and unicode) comparison to array objects.
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r-- | numpy/core/defchararray.py | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index aeba32fc5..f79389967 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -41,34 +41,34 @@ class chararray(ndarray): raise ValueError, "Can only create a chararray from string data." - def _richcmpfunc(self, other, op): - b = broadcast(self, other) - result = empty(b.shape, dtype=bool) - res = result.flat - for k, val in enumerate(b): - r1 = val[0].rstrip('\x00') - r2 = val[1] - res[k] = eval("r1 %s r2" % op, {'r1':r1,'r2':r2}) - return result - - # these should probably be moved to C - def __eq__(self, other): - return self._richcmpfunc(other, '==') - - def __ne__(self, other): - return self._richcmpfunc(other, '!=') - - def __ge__(self, other): - return self._richcmpfunc(other, '>=') - - def __le__(self, other): - return self._richcmpfunc(other, '<=') - - def __gt__(self, other): - return self._richcmpfunc(other, '>') - - def __lt__(self, other): - return self._richcmpfunc(other, '<') +## def _richcmpfunc(self, other, op): +## b = broadcast(self, other) +## result = empty(b.shape, dtype=bool) +## res = result.flat +## for k, val in enumerate(b): +## r1 = val[0].rstrip('\x00') +## r2 = val[1] +## res[k] = eval("r1 %s r2" % op, {'r1':r1,'r2':r2}) +## return result + + # these have been moved to C +## def __eq__(self, other): +## return self._richcmpfunc(other, '==') + +## def __ne__(self, other): +## return self._richcmpfunc(other, '!=') + +## def __ge__(self, other): +## return self._richcmpfunc(other, '>=') + +## def __le__(self, other): +## return self._richcmpfunc(other, '<=') + +## def __gt__(self, other): +## return self._richcmpfunc(other, '>') + +## def __lt__(self, other): +## return self._richcmpfunc(other, '<') def __add__(self, other): b = broadcast(self, other) |