Why does this vector shows elements multiple times?

Hi,

Is it normal that show has this behavior or I should report a bug ?

julia> struct Foo
       x
       end
julia> Base.show(io::IO, f::Foo) = print("Foo",f.x)

julia> foos = [Foo(1)]
1-element Vector{Foo}:
Foo1 Foo1Foo1

This seems to happen when showing a Vector whose elementtype has a customized show.

Shouldn’t it be print(io, "Foo", f.x)?

3 Likes

Ha yes that’s that… Thank you

1 Like