Skip to content

Changed printing of structured arrays does not extend to array scalars #8172

Closed

Description

@mhvk

In #8160, the printing of structured arrays was changed to ensure that elements could be formatted with the appropriate print functions. While investigating the resulting test failures for astropy (astropy/astropy#5419), I noticed that the behaviour has changed only for structured arrays, not for scalar structured elements:

In [6]: np.array([(1., 2.1234567890123456789, 3.)], dtype=('f8,f8,f8'))
Out[6]: 
array([( 1.,  2.12345679,  3.)], 
      dtype=[('f0', '<f8'), ('f1', '<f8'), ('f2', '<f8')])

In [7]: np.array((1., 2.1234567890123456789, 3.), dtype=('f8,f8,f8'))
Out[7]: 
array((1.0, 2.1234567890123457, 3.0), 
      dtype=[('f0', '<f8'), ('f1', '<f8'), ('f2', '<f8')])

Would it be possible for the code to work for scalars too?

Activity

  1. mhvk commented on Nov 2, 2016

    @mhvk
    ContributorAuthor

    #8200 indeed fixed this; thanks @skwbc, @ahaldane!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions