[Numpy-svn] r6132 - trunk/numpy/ma
numpy-svn at scipy.org
numpy-svn at scipy.org
Tue Dec 2 13:42:14 EST 2008
Author: pierregm
Date: 2008-12-02 12:42:12 -0600 (Tue, 02 Dec 2008)
New Revision: 6132
Modified:
trunk/numpy/ma/core.py
Log:
* Cleaned up make_mask_descr
Modified: trunk/numpy/ma/core.py
===================================================================
--- trunk/numpy/ma/core.py 2008-12-02 08:50:11 UTC (rev 6131)
+++ trunk/numpy/ma/core.py 2008-12-02 18:42:12 UTC (rev 6132)
@@ -800,20 +800,15 @@
"""
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:
More information about the Numpy-svn
mailing list