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

Base.getindex not implemented for Attribute type #838

Closed
david-macmahon opened this issue Jun 10, 2021 · 0 comments · Fixed by #839
Closed

Base.getindex not implemented for Attribute type #838

david-macmahon opened this issue Jun 10, 2021 · 0 comments · Fixed by #839

Comments

@david-macmahon
Copy link
Contributor

The only way I can see to get the value of an Attribute is through read(attr). I'd like to be able to use the Dataset-like way of accessing the value of an Attribute via the Base.getindex function (i.e. by using attr[] instead of read(attr)).

I see that src/HDF5.jl defines Base.getindex(dset::Dataset, I...), but the neighboring functions operate on a DatasetOrAttribute Union type. I can't find any comments in the code or in commit log messages that explain why this function is limited to just the Dataset type rather than the broader DatasetOrAttribute type.

The generic_read function used by getindex already operates on DatasetOrAttribute, which suggest that it's just an oversight, but is there some reason for restricting getindex to just Dataset types?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant