4.12 Cloning existing functions If you have a number of functions that look similar, you may be able to use Clinic’s “clone” feature. When you clone an existing function, you reuse: The only thing not copied from the original function is its docstring; the syntax allows you to specify a new docstring. Here’s the syntax for cloning a function: /*[clinic input] module.class.new_function [as c_basename] = module.class.existing_function Docstring for new_function goes here. [clinic start generated code]*/ /*[python input] # python code goes here [python start generated code]*/ /*[python input] print('static int __ignored_unused_variable__ = 0;') [python start generated code]*/ static int __ignored_unused_variable__ =0; /*[python checksum:...]*/ 16 As an example, here’s a Python block that adds a static integer variable to the C code: All the code inside the Python block is executed at the time it’s parsed. All text written to stdout inside the block is redirected into the “output” after the block. A Python block uses different delimiter lines than an Argument Clinic function block. It looks like this: The rest of the advanced topics require you to write Python code which lives inside your C file and modifies Argument Clinic’s runtime state. This is simple: you simply define a Python block. Also, the function you are cloning from must have been previously defined in the current file. Sorry, there’s no syntax for partially-cloning a function, or cloning a function then modifying it. Cloning is an all-or nothing proposition. (The functions can be in different modules or classes. I wrote$_{module.class}$ in the sample just to illustrate that you must use the full path to both functions.) 4.13 Calling Python code • its parameters, including – their names, – their converters, with all parameters, – their default values, – their per-parameter docstrings, – their kind (whether they’re positional only, positional or keyword, or keyword only), and • its return converter.