Skip to content

str values should be quoted in Array repr #1165

Description

@gdementen

String values should be quoted in Array.__repr__. Currently, they are indistinguishable from their numeric counterpart:

>>> a = Axis('a=a0,a1')
>>> arr = Array(["1", "2"], a)
>>> arr
a  a0  a1
    1   2
>>> arr = Array([1, 2], a)
>>> arr
a  a0  a1
    1   2

The problem is even worse for object/mixed type arrays:

>>> arr = Array([1, "2"], a, dtype=object)
>>> arr
a  a0  a1
    1   2

FWIW, numpy quotes string values:

>>> arr = np.array(["1", "2"])
>>> arr
['1' '2']

I am currently undecided whether to quote string values in the editor. There you at least have the background color hint.

Activity

  1. added this to the 0.36 milestone on Feb 25, 2026
  2. gdementen commented on Mar 3, 2026

    @gdementen
    ContributorAuthor

    Sadly, not as easy as I thought...

  3. modified the milestones: 0.36, 0.37 on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions