Skip to content

Commit 449ff4e

Browse files
committed
Document how to use varargs in Argument Clinic
1 parent 5fde845 commit 449ff4e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

development-tools/clinic.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,3 +2213,23 @@ and update your unit tests to reflect the new behaviour.
22132213
If you forget to update your input block during the alpha and beta phases,
22142214
the compiler warning will turn into a compiler error when the
22152215
release candidate phase begins.
2216+
2217+
2218+
How to convert variadic arguments functions
2219+
-------------------------------------------
2220+
2221+
Some functions can be called with an arbitrary number of arguments.
2222+
These arguments will be wrapped up in a tuple.
2223+
2224+
To convert a function to accept variadic arguments,
2225+
add a ``*`` in front of the parameter name just like Python,
2226+
and the parameter should use the ``object`` converter::
2227+
2228+
/*[clinic input]
2229+
vararg_sample
2230+
2231+
foo: int
2232+
*args: object
2233+
[clinic start generated code]*/
2234+
2235+
.. versionadded:: 3.11

0 commit comments

Comments
 (0)