[Numpy-svn] [numpy/numpy] 86efa7: ENH: Show subclass type in dtype repr and str of s...
GitHub
noreply at github.com
Sat Jan 24 12:41:20 EST 2015
Branch: refs/heads/master
Home: https://github.com/numpy/numpy
Commit: 86efa7dcc6e37dd35ac1ed9dbdcea19637670b50
https://github.com/numpy/numpy/commit/86efa7dcc6e37dd35ac1ed9dbdcea19637670b50
Author: Allan Haldane <allan.haldane at gmail.com>
Date: 2015-01-24 (Sat, 24 Jan 2015)
Changed paths:
M numpy/core/records.py
M numpy/core/src/multiarray/descriptor.c
M numpy/core/tests/test_records.py
Log Message:
-----------
ENH: Show subclass type in dtype repr and str of structured arrays
This is a modification to the dtype str and repr functions what helps
solve https://github.com/numpy/numpy/issues/3581.
I discussed it on the mailing list in a message "Re: structured arrays,
recarrays, and record arrays" on Jan 19 2015. I didn't get any replies,
but hopefully that merely means "no opinion" rather than "bad idea".
What it does: For structured arrays, if the dtype is not np.void then
print the dtype as `(base_dtype, dtype)`.
New Behavior:
>>> a = np.array([(1,'ABC'), (2, "DEF")], dtype=[('foo', int), ('bar', 'S4')])
>>> np.rec.array(a)
rec.array([(1, 'ABC'), (2, 'DEF')],
dtype=(numpy.record, [('foo', '<i8'), ('bar', 'S4')]))
>>> a.view(np.recarray)
rec.array([(1, 'ABC'), (2, 'DEF')],
dtype=[('foo', '<i8'), ('bar', 'S4')])
Commit: 7ce93ba046b1ff2fddd1f24090b21c01a7d6c25e
https://github.com/numpy/numpy/commit/7ce93ba046b1ff2fddd1f24090b21c01a7d6c25e
Author: Charles Harris <charlesr.harris at gmail.com>
Date: 2015-01-24 (Sat, 24 Jan 2015)
Changed paths:
M numpy/core/records.py
M numpy/core/src/multiarray/descriptor.c
M numpy/core/tests/test_records.py
Log Message:
-----------
Merge pull request #5483 from ahaldane/dtype_showtype
ENH: Show subclass type in dtype repr and str of structured arrays
Compare: https://github.com/numpy/numpy/compare/e1ff6268a2e2...7ce93ba046b1
More information about the Numpy-svn
mailing list