mirror of
https://github.com/astral-sh/ruff.git
synced 2025-11-17 03:18:38 +00:00
Merge bcddab6680 into 75c1a0ae55
This commit is contained in:
commit
f76697fd68
1 changed files with 20 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
# `cls`
|
||||
|
||||
```toml
|
||||
[environment]
|
||||
python-version = "3.13"
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
```py
|
||||
from typing import Type, Self
|
||||
|
||||
class C:
|
||||
@classmethod
|
||||
def make_instance(cls: Type[Self]) -> Self:
|
||||
return cls()
|
||||
|
||||
reveal_type(C.make_instance()) # revealed: C
|
||||
reveal_type(C.make_instance) # revealed: bound method <class 'C'>.make_instance() -> C
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue