How not to print types in Julia?

If I have an array of numbers:

a = [1,2,3]

and print it, I get

[1,2,3]

but if I have an array of, say, Tuples:

b = [(1,2),(3,)]

when i print it i get:

Tuple{Int64,Vararg{Int64}}[(1,2),(3,)]

How to avoid printing types?

+4
source share
1 answer

He cannot be suppressed.

julia> b = [(1,2), (3,)]
2-element Array{Tuple{Int64,Vararg{Int64}},1}:
 (1,2)
 (3,)

Perhaps the type is printed to show you that you include the type Vararg.

If you want to output without a message, you can go and write a wrapper for Base.show

0
source

Source: https://habr.com/ru/post/1629779/


All Articles