-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disallow scalars in cat
?
#34395
Comments
How do you handle |
Coming from my issue #38019 documenting a few of these oddities, concatenating scalars along one dimension seems like a reasonable function of To this issue, if Worth noting that in Julia 1.5, the example in the OP is less confusing:
|
If I'm following, disallowing "scalars" (i.e. values of type eltype) would avoid this terribly inconsistent situation: julia> vcat([(1,), (2,)], (3,))
3-element Vector{Tuple{Int64}}:
(1,)
(2,)
(3,)
julia> vcat([[1,], [2,]], [3,])
3-element Vector{Any}:
[1]
[2]
3 To concatenate one element, one can then use a one-element value, such as |
This came up on zulip today, with the following example:
The docstring of |
The
cat
functions are currently very permissive:This can lead to confusion when non-array collections are passed and mysteriously treated as scalars, e.g.
So a similar situation to what we had before in
broadcast
. We should make the corresponding change tocat
and require all arguments to be array-like somehow.The text was updated successfully, but these errors were encountered: