Should dtypes have an ndim attribute?

Hi, I have made a modest proposal in issue #6752 <https://github.com/numpy/numpy/issues/6752>. Basically, the proposal is to add an `ndim` attribute to dtypes. Currently, arrays have a shape and an ndim attribute, where ndim equals len(shape). dtype objects have a shape attribute, but no corresponding ndim. An ndim attribute would help in immediately determining whether a field in a structured dtype is multidimensional or not. Thoughts? Gerrit.

That's essentially what datashape did over in the blaze ecosystem. It gets a bit fancier to support ragged arrays and optional types. http://datashape.readthedocs.org/en/latest/ On Dec 10, 2015 5:14 AM, "Gerrit Holl" <gerrit.holl@gmail.com> wrote:

On Dec 10, 2015 4:11 AM, "Andy Ray Terrel" <andy.terrel@gmail.com> wrote:
That's essentially what datashape did over in the blaze ecosystem. It
gets a bit fancier to support ragged arrays and optional types.
IIUC this is a much more modest proposal, for numpy's existing dtypes that represent subarrays. It seems pretty harmless I guess. It's a little uncomfortable to be adding yet another attribute to all dtypes that will only be used by one obscure subset of dtypes, but it's no worse than a bunch of other already existing attributes in that respect. -n

That's essentially what datashape did over in the blaze ecosystem. It gets a bit fancier to support ragged arrays and optional types. http://datashape.readthedocs.org/en/latest/ On Dec 10, 2015 5:14 AM, "Gerrit Holl" <gerrit.holl@gmail.com> wrote:

On Dec 10, 2015 4:11 AM, "Andy Ray Terrel" <andy.terrel@gmail.com> wrote:
That's essentially what datashape did over in the blaze ecosystem. It
gets a bit fancier to support ragged arrays and optional types.
IIUC this is a much more modest proposal, for numpy's existing dtypes that represent subarrays. It seems pretty harmless I guess. It's a little uncomfortable to be adding yet another attribute to all dtypes that will only be used by one obscure subset of dtypes, but it's no worse than a bunch of other already existing attributes in that respect. -n
participants (3)
-
Andy Ray Terrel
-
Gerrit Holl
-
Nathaniel Smith