-
-
Notifications
You must be signed in to change notification settings - Fork 304
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
Error when using attribute keys with mixed types #1037
Comments
see:
I think I'd tend towards "Only strings are supported" but another sub-option would be to print a warning and automatically stringify. |
Agree on only supporting strings, much easier for everyone. |
@clbarnes (or anyone else): and thoughts on completely disallowing versus stringifying arguments? |
Strong preference for documenting/ annotating that keys must be strings (and that values must be json-serialisable), and not stringifying non-string keys (which would be unpredictable for different types). JavaScript gets pretty confusing with its string coercion, no need to open ourselves up to that. Python's got a whole lot better to develop in now there's more focus on sane types. Explicitly checking for key string-ness won't check for the JSON-validity the value (which might be a dict with non-string keys), so it's probably best to just leave it all up to the serialiser. |
@clbarnes, objection noted. I guess I'm most worried about the impact of the breaking change since at the moment a single update (
|
Maybe a couple of versions of noisy deprecation warnings, then? Even if it never actually gets patched out until v3. |
Strike that see #1125 |
Minimal, reproducible code sample, a copy-pastable example if possible
Problem description
I'm not able to assign attributes using keys with different types. Looks like the issue is coming from
json
that is trying to sort the keys. I guess there are 3 options:Version and installation information
zarr.__version__
: 2.11.3numcodecs.__version__
: 0.9.1conda env export
name: xarray
channels:
dependencies:
prefix: /Users/mattia/mambaforge/envs/xarray
The text was updated successfully, but these errors were encountered: