diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-07-28 16:27:18 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-07-28 16:27:18 +0000 |
commit | 471419fc4edca27993f8970306115e4c55a2c8a1 (patch) | |
tree | 379592b05849c9afd2bcb296638017bcee958d3f /numpy/core/defchararray.py | |
parent | 444891fc56cdc07a66ecce5c8837ae9578c94280 (diff) | |
download | numpy-471419fc4edca27993f8970306115e4c55a2c8a1.tar.gz |
Remove clash of string module and string numpy object by renaming string scalar object to string_. Fix up tickets #210 and #211
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r-- | numpy/core/defchararray.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py index 201a860cc..9e9e78122 100644 --- a/numpy/core/defchararray.py +++ b/numpy/core/defchararray.py @@ -1,4 +1,4 @@ -from numerictypes import string, unicode_, integer, object_ +from numerictypes import string_, unicode_, integer, object_ from numeric import ndarray, broadcast, empty from numeric import array as narray import sys @@ -8,7 +8,7 @@ __all__ = ['chararray'] _globalvar = 0 _unicode = unicode -# special sub-class for character arrays (string and unicode_) +# special sub-class for character arrays (string_ and unicode_) # This adds equality testing and methods of str and unicode types # which operate on an element-by-element basis @@ -21,7 +21,7 @@ class chararray(ndarray): if unicode: dtype = unicode_ else: - dtype = string + dtype = string_ _globalvar = 1 if buffer is None: @@ -300,17 +300,17 @@ def array(obj, itemsize=None, copy=True, unicode=False, order=None): itemsize = obj.itemsize if copy or (itemsize != obj.itemsize) \ or (not unicode and obj.dtype == unicode_) \ - or (unicode and obj.dtype == string): + or (unicode and obj.dtype == string_): return obj.astype("%s%d" % (obj.dtype.char, itemsize)) else: return obj - if isinstance(obj, ndarray) and (obj.dtype in [unicode_, string]): + if isinstance(obj, ndarray) and (obj.dtype in [unicode_, string_]): new = obj.view(chararray) - if unicode and obj.dtype == string: + if unicode and obj.dtype == string_: return new.astype((unicode_, obj.itemsize)) elif obj.dtype == unicode_: - return new.astype((string, obj.itemsize)) + return new.astype((string_, obj.itemsize)) if copy: return new.copy() else: return new |