@@ -389,7 +389,17 @@ We introduce a ``Param`` type that contains all the information about a function
389389 type ArgsParam[T] = Param[Literal[None], T, Literal["*"]]
390390 type KwargsParam[T] = Param[Literal[None], T, Literal["**"]]
391391
392- And then, we can represent the type of a function like::
392+ We also introduce a ``Params `` type that wraps a sequence of ``Param ``
393+ types, serving as the first argument to ``Callable ``::
394+
395+ class Params[*Ps]:
396+ pass
397+
398+ The presence of ``Params `` as the first argument to ``Callable ``
399+ distinguishes the extended callable format from the standard format.
400+ ``Params `` also serves as a natural bound for ``ParamSpec ``.
401+
402+ We can then represent the type of a function like::
393403
394404 def func(
395405 a: int,
@@ -406,7 +416,7 @@ And then, we can represent the type of a function like::
406416as::
407417
408418 Callable[
409- [
419+ Params [
410420 Param[Literal["a"], int, Literal["positional"]],
411421 Param[Literal["b"], int],
412422 Param[Literal["c"], int, Literal["default"]],
422432or, using the type abbreviations we provide::
423433
424434 Callable[
425- [
435+ Params [
426436 PosParam[Literal["a"], int],
427437 Param[Literal["b"], int],
428438 DefaultParam[Literal["c"], int],
@@ -1257,6 +1267,10 @@ We present implementations of a selection of them::
12571267 ]
12581268 ]
12591269
1270+ # KeyOf[T]
1271+ # Constructs a union of the names of every member of T.
1272+ type KeyOf[T] = Union[*[p.name for p in typing.Iter[typing.Members[T]]]]
1273+
12601274 # Exclude<T, U>
12611275 # Constructs a type by excluding from T all union members assignable to U.
12621276 type Exclude[T, U] = Union[
@@ -1884,10 +1898,6 @@ Open Issues
18841898 ``readonly `` had been added as a parameter to ``TypedDict `` we would
18851899 use that, but it wasn't.
18861900
1887- * :ref: `Extended Callables <pep827-extended-callables-prereq >`: Should the extended
1888- argument list be wrapped in a ``typing.Parameters[*Params] `` type (that
1889- will also kind of serve as a bound for ``ParamSpec ``)?
1890-
18911901* :ref: `Extended Callables <pep827-extended-callables-prereq >`: Currently the
18921902 qualifiers are short strings for code brevity, but an alternate approach
18931903 would be to mirror ``inspect.Signature `` more directly, and have an enum
0 commit comments