Message398687
Type expression is coerced to a list of parameter arguments in substitution of ParamSpec. For example:
>>> from typing import *
>>> T = TypeVar('T')
>>> P = ParamSpec('P')
>>> C = Callable[P, T]
>>> C[int, str]
typing.Callable[[int], str]
int becomes [int]. There is even a dedicated test for this.
But it is not followed from PEP 612. Furthermore, it contradicts one of examples in the PEP:
>>> class X(Generic[T, P]):
... f: Callable[P, int]
... x: T
...
>>> X[int, int] # Should be rejected
__main__.X[int, int]
It makes the implementation (at least the code in issue44796) more complex and makes the user code more errorprone. |
|
Date |
User |
Action |
Args |
2021-08-01 07:08:58 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, kj |
2021-08-01 07:08:58 | serhiy.storchaka | set | messageid: <1627801738.44.0.278142498011.issue44801@roundup.psfhosted.org> |
2021-08-01 07:08:58 | serhiy.storchaka | link | issue44801 messages |
2021-08-01 07:08:58 | serhiy.storchaka | create | |
|