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/6923#issuecomment-1217054150,https://api.github.com/repos/pydata/xarray/issues/6923,1217054150,IC_kwDOAMm_X85IisXG,14371165,2022-08-16T19:11:37Z,2022-08-16T19:12:02Z,MEMBER,"The https://peps.python.org/pep-0673/ has a few clear use cases. Here's a simple example with this PR uncommented:
```python
if TYPE_CHECKING:
from xarray.core.types import Self
class Foo:
def returns_self(self) -> Self:
return 1
```
```
!pyright G:\Program\Dropbox\Python\mypy_self_type.py
No configuration file found.stubPath G:\Program\Dropbox\Python\typings is not a valid directory.
No pyproject.toml file found.
Assuming Python platform Windows
Searching for source files
Found 1 source file
pyright 1.1.266
G:\Program\Dropbox\Python\mypy_self_type.py
G:\Program\Dropbox\Python\mypy_self_type.py:45:35 - error: ""Self"" is not exported from module ""xarray.core.types""
  Import from ""typing_extensions"" instead (reportPrivateImportUsage)
G:\Program\Dropbox\Python\mypy_self_type.py:50:16 - error: Expression of type ""Literal[1]"" cannot be assigned to return type ""Self@Foo""
  Type ""int"" cannot be assigned to type ""Foo""
    ""int"" is incompatible with ""Foo"" (reportGeneralTypeIssues)
2 errors, 0 warnings, 0 informations
Completed in 0.778sec
```
Wasn't that many obvious examples where this could be used now that I started to look for it... But here's a few ones where it could be used.
https://github.com/pydata/xarray/blob/60f8c3d3488d377b0b21009422c6121e1c8f1f70/xarray/core/indexes.py#L102-L103
https://github.com/pydata/xarray/blob/6b1d97ae16e4abaf4e29de2c19faca4239d0ab01/xarray/backends/common.py#L133-L134
https://github.com/pydata/xarray/blob/fbaf815af746a73b29c2b927ccb3aaf37f3a8721/xarray/plot/facetgrid.py#L297","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1340745375