From 311c7ffbc3d5850bd0fd08a88f8e29bb836ac944 Mon Sep 17 00:00:00 2001 From: Daraan Date: Wed, 28 Jan 2026 16:24:08 +0100 Subject: [PATCH 1/4] Clarify: variadic positional parameters can be expressed with Callable --- docs/spec/callables.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/spec/callables.rst b/docs/spec/callables.rst index b189c482..628f3b71 100644 --- a/docs/spec/callables.rst +++ b/docs/spec/callables.rst @@ -453,8 +453,8 @@ a function within a type expression. The syntax is Parameters specified using ``Callable`` are assumed to be positional-only. The ``Callable`` form provides no way to specify keyword-only parameters, -variadic parameters, or default argument values. For these use cases, see -the section on `Callback protocols`_. +variadic keyword-only parameters, or default argument values. For these use +cases, see the section on `Callback protocols`_. Meaning of ``...`` in ``Callable`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -535,6 +535,14 @@ to be :term:`consistent` with any input parameters:: f3: CallbackWithInt[...] = cb # OK f4: CallbackWithStr[...] = cb # Error + +Variadic positional parameter types can be defined with ``...`` in combination +with an unpacked tuple of the form ``tuple[int, ...]``. The first argument +specifies the type of the variadic parameters. For example, the +following defines a callable that accepts any amount of integer arguments:: + + type VarCallback = Callable[[*tuple[int, ...]], None] + .. _`callback-protocols`: Callback protocols From 11dfa0e6c75ee889d91e94a81c72eef93e2032ff Mon Sep 17 00:00:00 2001 From: Daraan Date: Wed, 28 Jan 2026 16:48:16 +0100 Subject: [PATCH 2/4] Remove notion about variadics completely --- docs/spec/callables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/callables.rst b/docs/spec/callables.rst index 628f3b71..e0e29bf6 100644 --- a/docs/spec/callables.rst +++ b/docs/spec/callables.rst @@ -453,8 +453,8 @@ a function within a type expression. The syntax is Parameters specified using ``Callable`` are assumed to be positional-only. The ``Callable`` form provides no way to specify keyword-only parameters, -variadic keyword-only parameters, or default argument values. For these use -cases, see the section on `Callback protocols`_. +or default argument values. For these use cases, see the section on +`Callback protocols`_. Meaning of ``...`` in ``Callable`` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 747db022a34a224138dc4e13507bc372066880a0 Mon Sep 17 00:00:00 2001 From: Daraan Date: Wed, 28 Jan 2026 17:00:24 +0100 Subject: [PATCH 3/4] _ --- docs/spec/callables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/spec/callables.rst b/docs/spec/callables.rst index e0e29bf6..4794acd5 100644 --- a/docs/spec/callables.rst +++ b/docs/spec/callables.rst @@ -538,8 +538,8 @@ to be :term:`consistent` with any input parameters:: Variadic positional parameter types can be defined with ``...`` in combination with an unpacked tuple of the form ``tuple[int, ...]``. The first argument -specifies the type of the variadic parameters. For example, the -following defines a callable that accepts any amount of integer arguments:: +specifies the type of the variadic parameters. For example, the following +defines a callable that accepts any number of integer arguments:: type VarCallback = Callable[[*tuple[int, ...]], None] From b618f4028d99a61cf7f43f4ae672f099476e26cd Mon Sep 17 00:00:00 2001 From: Daraan Date: Thu, 29 Jan 2026 00:07:28 +0100 Subject: [PATCH 4/4] reword --- docs/spec/callables.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/spec/callables.rst b/docs/spec/callables.rst index 4794acd5..a6e4549d 100644 --- a/docs/spec/callables.rst +++ b/docs/spec/callables.rst @@ -536,10 +536,11 @@ to be :term:`consistent` with any input parameters:: f4: CallbackWithStr[...] = cb # Error -Variadic positional parameter types can be defined with ``...`` in combination -with an unpacked tuple of the form ``tuple[int, ...]``. The first argument -specifies the type of the variadic parameters. For example, the following -defines a callable that accepts any number of integer arguments:: +Variadic positional parameter types can be defined with with an unpacked tuple +of the form ``*tuple[int, ...]`` in the parameter list. The first argument +specifies the type of the variadic parameters. +For example, the following defines a callable that accepts any number of integer +arguments:: type VarCallback = Callable[[*tuple[int, ...]], None]