-
Notifications
You must be signed in to change notification settings - Fork 272
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
Feature
A similar feature in typescript
const foo: number = 1
type Foo = typeof foo // type Foo = number
function bar(x: string): void {
}
type Bar = typeof bar // type Bar = (x: string) => void
Pitch
The expected way in future python.
Possible implementation: implement __class_getitem__
for type
:
foo: int = 1
Foo = type[foo] # equivalent to Foo = int
def bar(x: string) -> None :
...
Bar = type[bar] # equivalent to Bar = Callable[[str], None]
codethief, Dudeonyx, atsuoishimoto, chdsbd, sarahriethmueller and 66 more
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations