diff options
author | Allan Haldane <allan.haldane@gmail.com> | 2015-01-29 12:54:25 -0500 |
---|---|---|
committer | Allan Haldane <allan.haldane@gmail.com> | 2015-01-30 11:25:39 -0500 |
commit | 73a74e9e9515ad76d652e998fc1e88074e8cd820 (patch) | |
tree | 98fec161818c717ed1fa60f7e75a1ba8ae7209c6 /numpy/polynomial/polyutils.py | |
parent | 8149c36abb651480202ff55a9b80efda9278be0f (diff) | |
download | numpy-73a74e9e9515ad76d652e998fc1e88074e8cd820.tar.gz |
BUG: recarray __repr__ gives inaccurate representation
In https://github.com/numpy/numpy/pull/5483, I solved the problem that a
"recarray" and a "record array" (nomenclature defined in
https://github.com/numpy/numpy/pull/5482) looked identical by making
sure that a type's subclass was listed in the repr. However, recarrays
are still represented using the function 'rec.array' even though this
function technically creates record arrays, not recarrays.
So I have updated recarray.__repr__.
Setup:
>>> a = np.array([(1,'ABC'), (2, "DEF")], dtype=[('foo', int), ('bar', 'S4')])
>>> recordarr = np.rec.array(a)
>>> recarr = a.view(np.recarray)
Behavior after https://github.com/numpy/numpy/pull/5483:
>>> recordarr
rec.array([(1, 'ABC'), (2, 'DEF')],
dtype=(numpy.record, [('foo', '<i8'), ('bar', 'S4')]))
>>> recarr
rec.array([(1, 'ABC'), (2, 'DEF')],
dtype=[('foo', '<i8'), ('bar', 'S4')])
New Behavior:
>>> recordarr
rec.array([(1, 'ABC'), (2, 'DEF')],
dtype=[('foo', '<i8'), ('bar', '|S4')])
>>> recarr
array([(1, 'ABC'), (2, 'DEF')],
dtype=[('foo', '<i8'), ('bar', 'S4')]).view(numpy.recarray)
Diffstat (limited to 'numpy/polynomial/polyutils.py')
0 files changed, 0 insertions, 0 deletions