-
-
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
[Feature Request] Multiple values from NamedTuple #38834
Comments
Another suggestions from slack helpdesk:
|
The correct way to do it currently is
i.e. the generator there is just redundant. We could maybe define
though this also conflicts with Dicts unfortunately. |
Do you mean conceptually or literally?
but I guess because this signature is so dissimilar from the types of selection syntax I'm used to, I skimmed past it. |
I guess we could add the |
afaik The conflict is limited to Dicts with key[s] that are typed I do not find the conflict all that concerning. If the desire is for conflict-free |
duplicate of #27021 |
I think it would be useful to have some syntax for returning a subset of a
NamedTuple
as anotherNamedTuple
, analogous to the same ability with regularTuple
s.The following works, though I don't know if it's the most efficient:
I'm not advocating it actually be called
get
- I think something that worked withgetindex
would be ideal. NamedTupleTools.jl has a method calledselect
that does this, but it seems like this functionality would be great to have in Base.One counter argument is that this doesn't work with
Dict
sBut it is technically possible to have an array as a key in a
Dict
, but not for aNamedTuple
.I'm happy to make a PR if this idea is acceptable, and if there aren't any implications that are escaping me.
The text was updated successfully, but these errors were encountered: