Skip to content

string() not vectorized like other small caps type conversions #8389

Closed

Description

julia> int([0:2])
3-element Array{Int64,1}:
 0
 1
 2

julia> float([0:2])
3-element Array{Float64,1}:
 0.0
 1.0
 2.0

julia> bool([0:2])
3-element Array{Bool,1}:
 false
  true
  true

julia> string([0:2])
"[0,1,2]"

I'd find it more consistent if string returned what is currently [string(x) for x in 0:2]. And it seems to me the latter operation is much more common than expecting "[0,1,2]", which is useful only in very special contexts. Maybe call it deparse, stringrep or something like that? Or simply use the String constructor, which by definition must return a String object, not an Array{<:String}?

This is related to #1470.

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

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