New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

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.

----------
messages: 398687
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Type expression is coerced to a list of parameter arguments in 
substitution of ParamSpec

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44801>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to