Hey, I'm trying to store a "0 kwargs" object. I.e. the result of ((;k...) -> k)()
. I see the type is Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}()
, but that seems to be uninstantiable. The closest I could get was Base.Pairs(NamedTuple(),())
but that gives Base.Pairs{Union{}, ...
instead of `Base.Pairs{Symbol, ...
.
Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}(NamedTuple(),())
works, no?
It's an immutable (and also is a singleton). So, why not just do const NOKWARGS = ((;k...) -> k)()
and use it where you need it?
Sebastian Pfitzner said:
Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}(NamedTuple(),())
works, no?
Ah, that does it. I just hadn't figured out the arguments needed to construct it. Thanks :)
Timothy has marked this topic as resolved.
Last updated: Nov 22 2024 at 04:41 UTC