This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients gvanrossum, kj, serhiy.storchaka
Date 2021-08-01.07:08:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1627801738.44.0.278142498011.issue44801@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-08-01 07:08:58serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, kj
2021-08-01 07:08:58serhiy.storchakasetmessageid: <1627801738.44.0.278142498011.issue44801@roundup.psfhosted.org>
2021-08-01 07:08:58serhiy.storchakalinkissue44801 messages
2021-08-01 07:08:58serhiy.storchakacreate