@@ -131,7 +131,7 @@ Optional arguments
131131
132132Keys marked ``NotRequired `` in the ``TypedDict `` correspond to optional
133133keyword arguments.
134- Meaning the callable must accept them, but callers may omit them.
134+ This means that the callable must accept them, but callers may omit them.
135135Functions that accept the keyword argument must also provide a default value
136136that is compatible; functions that omit the parameter entirely are rejected::
137137
@@ -195,7 +195,7 @@ arguments beyond those declared are expected::
195195Interaction with ``extra_items `` (PEP 728)
196196~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
197197
198- If a ``TypedDict `` specifies the ``extra_items `` parameter (with the exemption
198+ If a ``TypedDict `` specifies the ``extra_items `` parameter (with the exception
199199of ``extra_items=Never ``), the corresponding ``Callable ``
200200must accept additional keyword arguments of the specified type.
201201
@@ -276,7 +276,7 @@ taught that with ::
276276 ``__call__(self, a: int, b: str = ..., **kwargs: object) -> R ``.
277277* Teachers might want to introduce the concept of ``TypedDict `` with
278278 ``Callable `` first before introducing ``Protocol ``.
279- * The implicit addition of ``**kwargs: object `` might come surprising to users,
279+ * The implicit addition of ``**kwargs: object `` might be surprising to users;
280280 using ``closed=True `` for definitions will create the more intuitive
281281 equivalence of ``__call__(self, a: int, b: str = ...) -> R ``
282282* Users should be made aware of the interaction with ``extra_items `` from
@@ -309,6 +309,29 @@ Open Questions
309309 should apply in such a case? Should the order matter?
310310* Is there a necessity to differentiate between normal and ``ReadOnly `` keys?
311311
312+ Allowing ``... `` in parameter list
313+ ----------------------------------
314+
315+ A further extension would be to allow ``... `` in combination with ``Unpack[TD] ``,
316+ for example ``Callable[[int, ..., Unpack[TD]], R] ``, to indicate that there may
317+ be additional positional parameters before the specified keyword-only
318+ parameters. This would be equivalent to
319+ ``def func(a: int, *args: Any, **kwargs: Unpack[TD]) -> R: ... ``.
320+ Currently, ``... `` is only allowed as the sole parameter in ``Callable `` or it
321+ must be the last argument in ``Concatenate ``.
322+
323+ The semantics are different: within ``Concatenate ``, ``... `` indicates
324+ additional parameters of any kind, whereas in this proposed usage it would
325+ indicate only additional positional parameters.
326+ Should this behavior be part of this PEP, or would it introduce too much
327+ ambiguity about where ``... `` is allowed?
328+ As a follow-up or alternative, should ``... `` also be allowed before the end of
329+ the parameter list without ``Unpack[TD] ``, with the same meaning it has in
330+ ``Concatenate `` (i.e., ``Callable[[int, ...], R] `` being equivalent to
331+ ``Callable[Concatenate[int, ...], R] ``)?
332+ This would allow a more user-friendly syntax without requiring users to learn
333+ about ``Concatenate ``.
334+
312335Acknowledgements
313336================
314337
0 commit comments