Shorthand for a function that returns kwargs

Since Julia 1.6+ or so, you can do this:

julia> get_abc(;a,b,c) = (; a, b, c)
get_abc (generic function with 1 method)

julia> get_abc(a=1, b=2, c=3)
(a = 1, b = 2, c = 3)

or this:

julia> get_kws(; kwargs...) = (; kwargs...)
get_kws (generic function with 1 method)

julia> get_kws(; a = 1, b = 2, c = 3)
(a = 1, b = 2, c = 3)
3 Likes