File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -453,8 +453,8 @@ a function within a type expression. The syntax is
453453
454454Parameters specified using ``Callable `` are assumed to be positional-only.
455455The ``Callable `` form provides no way to specify keyword-only parameters,
456- variadic parameters, or default argument values. For these use cases, see
457- the section on `Callback protocols `_.
456+ variadic keyword-only parameters, or default argument values. For these use
457+ cases, see the section on `Callback protocols `_.
458458
459459Meaning of ``... `` in ``Callable ``
460460^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -535,6 +535,14 @@ to be :term:`consistent` with any input parameters::
535535 f3: CallbackWithInt[...] = cb # OK
536536 f4: CallbackWithStr[...] = cb # Error
537537
538+
539+ Variadic positional parameter types can be defined with ``... `` in combination
540+ with an unpacked tuple of the form ``tuple[int, ...] ``. The first argument
541+ specifies the type of the variadic parameters. For example, the
542+ following defines a callable that accepts any amount of integer arguments::
543+
544+ type VarCallback = Callable[[*tuple[int, ...]], None]
545+
538546.. _`callback-protocols` :
539547
540548Callback protocols
You can’t perform that action at this time.
0 commit comments