Given the following block of code:
import typing as tp
T = tp.TypeVar("T")
def dummy(item: T) -> T:
return item
reveal_type(dummy)
When run onto it, pyright
prints:
❯ pyright type_arobase.py
< some output trimmed >
/home/gregoire.roussel/dev/wdc/python/type_arobase.py
/home/gregoire.roussel/dev/wdc/python/type_arobase.py:8:13 - information: Type of "dummy" is "(item: T@dummy) -> T@dummy"
0 errors, 0 warnings, 1 information
Completed in 0.617sec
Note the T@dummy
in the output.
- Why does
pyright
feel the need to suffix all generic types with a@function_name
? - What additional information does it bring compared to the original signature
(item: T) -> T
?
Note: I found in the pyright doc this paragraph that mentions this phenomenon in the special case of self
and cls
argument, without more details.