File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
Expand file tree Collapse file tree 1 file changed +11
-2
lines changed 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+ or default argument values. For these use cases, see the section on
457+ `Callback protocols `_.
458458
459459Meaning of ``... `` in ``Callable ``
460460^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -535,6 +535,15 @@ 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 with an unpacked tuple
540+ of the form ``*tuple[int, ...] `` in the parameter list. The first argument
541+ specifies the type of the variadic parameters.
542+ For example, the following defines a callable that accepts any number of integer
543+ arguments::
544+
545+ type VarCallback = Callable[[*tuple[int, ...]], None]
546+
538547.. _`callback-protocols` :
539548
540549Callback protocols
You can’t perform that action at this time.
0 commit comments