Open
Description
openedon Aug 26, 2018
Among the functions for reshaping arrays (reshape
, permutedims
, dropdims
), dropdims
is the only one that accepts dims
as a keyword argument — the rest take dimensions as a positional argument.
julia> permutedims([1 2 3], (2, 1))
3×1 Array{Int64,2}:
1
2
3
Also, it feels a little redundant to have to say "dims" twice, once in the argument and once in the name of the function:
julia> dropdims([1 2 3], dims=(1,))
3-element Array{Int64,1}:
1
2
3
julia> dropdims([1 2 3], (1,))
ERROR: MethodError: no method matching dropdims(::Array{Int64,2}, ::Tuple{Int64})
Note: It's possible to make this change backwards-compatibly by accepting both the keyword and positional argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Metadata
Assignees
Labels
No labels