Skip to content
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

Index into NamedTuple with ::Colon #47821

Closed
kescobo opened this issue Dec 7, 2022 · 7 comments
Closed

Index into NamedTuple with ::Colon #47821

kescobo opened this issue Dec 7, 2022 · 7 comments
Labels
collections Data structures holding multiple items, e.g. sets good first issue Indicates a good issue for first-time contributors to Julia

Comments

@kescobo
Copy link
Contributor

kescobo commented Dec 7, 2022

I should probably have put this in in #38878.

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

julia> nt[[:a, :b]]
(a = 1, b = 2)

julia> nt[:]
ERROR: MethodError: no method matching getindex(::NamedTuple{(:a, :b, :c), Tuple{Int64, Int64, Int64}}, ::Colon)
@brenhinkeller brenhinkeller added the collections Data structures holding multiple items, e.g. sets label Dec 7, 2022
@Moelf
Copy link
Contributor

Moelf commented Dec 8, 2022

what's the expected behavior?

getindex(a::NamedTuple, ::Colon) = a

?

@kescobo
Copy link
Contributor Author

kescobo commented Dec 8, 2022

Yeah, I think so.

@Moelf
Copy link
Contributor

Moelf commented Dec 8, 2022

add "good first issue"?

@StefanKarpinski StefanKarpinski added the good first issue Indicates a good issue for first-time contributors to Julia label Dec 8, 2022
@x0samnan
Copy link

x0samnan commented Dec 8, 2022

Hello, I am actually new to open-source. I have tried Julia and thought of getting involved in the community. Since, its a good first issue, can I get some help?

@kescobo
Copy link
Contributor Author

kescobo commented Dec 8, 2022

@x0samnan I would take a look at this blog post. It's a bit dated, but is a good starting point.

Though I was planning to tackle this since it's my fault it got left out 🤷, there are lot of good first issues you could check out :-)

@x0samnan
Copy link

x0samnan commented Dec 8, 2022

@kescobo Thank You for the response. I will make sure to check them out.

@kescobo
Copy link
Contributor Author

kescobo commented Dec 12, 2022

Closed in #47842

@kescobo kescobo closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
collections Data structures holding multiple items, e.g. sets good first issue Indicates a good issue for first-time contributors to Julia
Projects
None yet
Development

No branches or pull requests

5 participants