summaryrefslogtreecommitdiff
path: root/numpy/core/defchararray.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r--numpy/core/defchararray.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index cc6cb5a38..92ea8209c 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -1849,12 +1849,14 @@ class chararray(ndarray):
def __getitem__(self, obj):
val = ndarray.__getitem__(self, obj)
- if issubclass(val.dtype.type, character) and not _len(val) == 0:
+
+ if isinstance(val, character):
temp = val.rstrip()
if _len(temp) == 0:
val = ''
else:
val = temp
+
return val
# IMPLEMENTATION NOTE: Most of the methods of this class are