diff options
author | weathergod <?@?> | 2010-11-21 18:37:51 -0700 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2010-11-24 20:14:00 -0700 |
commit | 3b8cf12ee19994389ae3261666dd32cced4787be (patch) | |
tree | 074f147269ff8aaab53f921a38684ce0202ba9e4 /numpy/lib/recfunctions.py | |
parent | 8fa2591fee88937b81c39a6c529fa66975f88856 (diff) | |
download | numpy-3b8cf12ee19994389ae3261666dd32cced4787be.tar.gz |
BUG: Fix logic in handling of dtype in append_fields.
Diffstat (limited to 'numpy/lib/recfunctions.py')
-rw-r--r-- | numpy/lib/recfunctions.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/lib/recfunctions.py b/numpy/lib/recfunctions.py index 3c0094aae..da0c3e8ac 100644 --- a/numpy/lib/recfunctions.py +++ b/numpy/lib/recfunctions.py @@ -614,8 +614,10 @@ def append_fields(base, names, data=None, dtypes=None, if dtypes is None: data = [np.array(a, copy=False, subok=True) for a in data] data = [a.view([(name, a.dtype)]) for (name, a) in zip(names, data)] - elif not hasattr(dtypes, '__iter__'): - dtypes = [dtypes, ] + else : + if not hasattr(dtypes, '__iter__'): + dtypes = [dtypes, ] + if len(data) != len(dtypes): if len(dtypes) == 1: dtypes = dtypes * len(data) |