issues: 1094725752
This data as json
id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1094725752 | I_kwDOAMm_X85BQDB4 | 6142 | dimensions: type as `str | Iterable[Hashable]`? | 10194086 | open | 0 | 14 | 2022-01-05T20:39:00Z | 2022-06-26T11:57:40Z | MEMBER | What happened?We generally type dimensions as:
However, this is in conflict with passing a tuple of independent dimensions to a method - e.g. Also mypy requires an What did you expect to happen?In the community call today we discussed to change this to
i.e. if a single dim is passed it has to be a string and wrapping it in a list is a convenience function. Special use cases with The disadvantage could be that it is a bit more difficult to explain in the docstrings? @shoyer - did I get this right from the discussion? Other options
This could be too restrictive. @keewis mentioned that tuple dimension names are already used somwehere in the xarray repo. Also we discussed in another issue or PR (which I cannot find right know) that we want to keep allowing
This is too restrictive in the other direction and will probably lead to a lot of downstream troubles. Naming a single dimension with a tuple will be a very rare case, in contrast to passing several dimension names as a tuple.
Minimal Complete Verifiable ExampleNo response Relevant log outputNo response Anything else we need to know?
but tuples are not actually allowed: ```python import xarray as xr xr.DataArray([1], dims=("x", "y")) ValueError: different number of dimensions on data and dims: 1 vs 2xr.DataArray([1], dims=[("x", "y")]) TypeError: dimension ('x', 'y') is not a string```
EnvironmentN/A |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/6142/reactions", "total_count": 2, "+1": 2, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
13221727 | issue |