diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-05-09 19:56:23 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-05-09 19:56:23 +0000 |
commit | d874c8beca6c62c5cabcffae87bde647576329fc (patch) | |
tree | a43a4b5fc3cae713c7d21c5ab955273fadc99233 /numpy/core/records.py | |
parent | 4a0b99752e3d0fc70e643bf27b13b315edaf7440 (diff) | |
download | numpy-d874c8beca6c62c5cabcffae87bde647576329fc.tar.gz |
Fix field method to always return fields. Fixes ticket #101
Diffstat (limited to 'numpy/core/records.py')
-rw-r--r-- | numpy/core/records.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py index a32ad5933..d97d840ea 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -203,10 +203,17 @@ class recarray(sb.ndarray): if isinstance(attr,int): attr=fielddict[-1][attr] + res = fielddict[attr][:2] + if val is None: - return self.__getattribute__(attr) + obj = self.getfield(*res) + if obj.dtype.fields: + return obj + if obj.dtype.char in 'SU': + return obj.view(chararray) + return obj.view(sb.ndarray) else: - return self.__setattr__(attr,val) + return self.setfield(val, *res) def fromarrays(arrayList, formats=None, names=None, titles=None, shape=None, aligned=0): |