Skip to content

str values should be quoted in Array repr #1165

@gdementen

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions