[issue42610] Get the type of from a var

2020-12-09 Thread dimitri.wei


Change by dimitri.wei :


--
components:  -Demos and Tools

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42610] Get the type of from a var

2020-12-09 Thread dimitri.wei


New submission from dimitri.wei :

**Feature**
A similar feature in typescript
```ts
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.
```py
from typing import 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]
```

--
components: Demos and Tools
messages: 382792
nosy: wlf100220
priority: normal
severity: normal
status: open
title: Get the type of from a var
type: enhancement
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com