diff options
author | pierregm <pierregm@localhost> | 2008-12-02 18:42:12 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2008-12-02 18:42:12 +0000 |
commit | 906576137c9b883a5638e4d71f91fbf4d33aca5e (patch) | |
tree | 9f8310aa271379df242c14ff7914146bfaf8b1f3 /numpy/ma/core.py | |
parent | ac338653590e858f7a9f96a84a6de9a6cdc6b323 (diff) | |
download | numpy-906576137c9b883a5638e4d71f91fbf4d33aca5e.tar.gz |
* Cleaned up make_mask_descr
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 510a59d1a..23f6bc037 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -800,20 +800,15 @@ def make_mask_descr(ndtype): """ def _make_descr(datatype): "Private function allowing recursion." - datatype = np.dtype(datatype) # Do we have some name fields ? if datatype.names: descr = [] - # !!!: If one of the fieldnames is a tuple, only its last element - # !!!: is listed in datatype.names: we need to take datatype.descr. - for name in (_[0] for _ in datatype.descr): - # Take the last element of the tuple as key for datatype.fields - if isinstance(name, tuple): - # datatype.fields[name] is a tuple of 2 or 3 element... - ndtype = datatype.fields[name[-1]][0] - else: - ndtype = datatype.fields[name][0] - descr.append((name, _make_descr(ndtype))) + for name in datatype.names: + field = datatype.fields[name] + if len(field) == 3: + # Prepend the title to the name + name = (field[-1], name) + descr.append((name, _make_descr(field[0]))) return descr # Is this some kind of composite a la (np.float,2) elif datatype.subdtype: |