html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/pull/5477#issuecomment-1323755762,https://api.github.com/repos/pydata/xarray/issues/5477,1323755762,IC_kwDOAMm_X85O5ujy,43316012,2022-11-22T14:22:33Z,2022-11-22T14:22:33Z,COLLABORATOR,"Yes exactly, that would be the intended way of working with dimensions/variables that are iterablea themself, like tuples.","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1323708057,https://api.github.com/repos/pydata/xarray/issues/5477,1323708057,IC_kwDOAMm_X85O5i6Z,5635139,2022-11-22T13:49:45Z,2022-11-22T13:49:45Z,MEMBER,"> I would say that a tuple is fine, it IS an iterable of hashable ;)
Sorry, yes, I was unclear above!
How should we handle dimensions which are themselves tuples? (i.e. a really unlikely corner-case, but one that IIRC inspired some of the discussion in https://github.com/pydata/xarray/issues/4821)
My thought was to interpret a tuple as an iterable of dimensions. If we have a dimension name of a tuple, then that requires passing _within_ an Iterable — i.e. the `method(dim=[('a','b')])`. Since the mypy changes around `str | Iterable[Hashable]`, this seems better than the options I enumerated at https://github.com/pydata/xarray/issues/4821#issuecomment-766166088.
Does that make sense? V possible my writing and / or thinking is still not clear!","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1323694111,https://api.github.com/repos/pydata/xarray/issues/5477,1323694111,IC_kwDOAMm_X85O5fgf,43316012,2022-11-22T13:39:11Z,2022-11-22T13:39:11Z,COLLABORATOR,"> So we'd keep `str | Iterable[Hashable]`, and still raise an error if a tuple was passed directly (i.e. `method(dim=('a','b'))`
I would say that a tuple is fine, it IS an iterable of hashable ;)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1323638086,https://api.github.com/repos/pydata/xarray/issues/5477,1323638086,IC_kwDOAMm_X85O5R1G,5635139,2022-11-22T12:56:20Z,2022-11-22T12:56:20Z,MEMBER,"> I think this should be also aligned with `str | Iterable[Hashable]`, so maybe `str | DataArray | Iterable[Hashable | DataArray]`?
Good point...
IIUC (and it's been a while since I thought through this properly), this would support allowing tuples as dimension names, but forcing them to be passed within an iterable to methods (e.g.`method(dim=[('a','b')])` for a dimension named `('a', 'b')`. So we'd keep `str | Iterable[Hashable]`, and still raise an error if a tuple was passed directly (i.e. `method(dim=('a','b'))`","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1322745490,https://api.github.com/repos/pydata/xarray/issues/5477,1322745490,IC_kwDOAMm_X85O136S,43316012,2022-11-21T22:37:09Z,2022-11-21T22:37:09Z,COLLABORATOR,"I think this should be also aligned with `str | Iterable[Hashable]`, so maybe `str | DataArray | Iterable[Hashable | DataArray]`?
And then reverse the isinstance checks (do not capture tuple and list explicitly, but str).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1121402549,https://api.github.com/repos/pydata/xarray/issues/5477,1121402549,IC_kwDOAMm_X85C1z61,37740986,2022-05-09T17:53:56Z,2022-05-09T17:53:56Z,CONTRIBUTOR,"I would like to continue to contribute to xarray, unfortunately I have many important matters theses days. I may contribute again from end of summer. If someone wants to tackle this issue until then, he can","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-1115433428,https://api.github.com/repos/pydata/xarray/issues/5477,1115433428,IC_kwDOAMm_X85CfCnU,5635139,2022-05-02T22:30:19Z,2022-05-02T22:30:19Z,MEMBER,This was quite close @thomashirtz — let me know if you'd be up for finishing it off. Thanks,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807
https://github.com/pydata/xarray/pull/5477#issuecomment-864225970,https://api.github.com/repos/pydata/xarray/issues/5477,864225970,MDEyOklzc3VlQ29tbWVudDg2NDIyNTk3MA==,5635139,2021-06-18T19:09:26Z,2021-06-18T19:09:26Z,MEMBER,"This looks good!
The one corner case I'm not sure this handles is when there is actually a tuple dimension. If that's correct, could we add a test for that case, and maybe [here](https://github.com/pydata/xarray/pull/5477/files#diff-763e3002fd954d544b05858d8d138b828b66b6a2a0ae3cd58d2040a652f14638R1384) check that it's a tuple _and_ it's not in the dimensions?
> The code `xr.Dataset({""a"": ([(""a"", ""b"")], [1])})` does not error yet.
Great, tbc we want that construction to pass — we're saying it's allowable to have tuples as dimension names (while not encouraging it!)
Thanks @thomashirtz ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,922926807