Skip to content

Commit 2bc51ed

Browse files
Daniel SperberDaraan
authored andcommitted
Move Unpack[TD] -> ParamSpec substitution into Open Questions
1 parent dda392e commit 2bc51ed

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

peps/pep-0821.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,6 @@ and ``**kwargs``, which conflicts with ``Unpack[TD]``::
192192

193193
Callable[[P, Unpack[KeywordTD]], R] # Not allowed
194194

195-
When specializing a generic type parameterized by a ``ParamSpec``, an
196-
unpacked ``TypedDict`` can be used as a type argument.
197-
This applies regardless of whether a ``Callable`` special form is
198-
involved::
199-
200-
type CallableP[**P] = Callable[P, Any]
201-
202-
h: CallableP[Unpack[KeywordTD]] = normal # Accepted
203-
h2: CallableP[Unpack[KeywordTD]] = kw_only # Accepted
204-
h3: CallableP[Unpack[KeywordTD]] = pos_only # Rejected
205-
206195
Backwards Compatibility
207196
=======================
208197

@@ -298,6 +287,17 @@ Rejected Ideas
298287
Open Questions
299288
==============
300289

290+
* Should this PEP explicitly allow a ``ParamSpec`` to be substituted by an
291+
unpacked ``TypedDict`` in generic type arguments, independent of
292+
``Callable``? This would broaden the scope beyond ``Callable`` and would
293+
apply to any generic parameterized by a ``ParamSpec``. For example::
294+
295+
type CallableP[**P] = Callable[P, Any]
296+
297+
h: CallableP[Unpack[KeywordTD]] = normal # Accepted
298+
h2: CallableP[Unpack[KeywordTD]] = kw_only # Accepted
299+
h3: CallableP[Unpack[KeywordTD]] = pos_only # Rejected
300+
301301
* Should ``Unpack`` of a generic ``TypedDict`` be permitted inside
302302
``Callable``? For example::
303303

0 commit comments

Comments
 (0)