• Function calls. • Inline if statements ($_{3 if foo else 5}$ ). • Automatic sequence unpacking ($_{*[1, 2, 3]}$ ). • List/set/dict comprehensions and generator expressions. • Tuple/list/set/dict literals. 4.11 Using a return converter By default the impl function Argument Clinic generates for you returns PyObject * . But your C function often computes some C type, then converts it into the$_{PyObject *}$ at the last moment. Argument Clinic handles con- verting your inputs from Python types into native C types—why not have it convert your return value from a native C type into a Python type too? That’s what a “return converter” does. It changes your impl function to return some C type, then adds code to the generated (non-impl) function to handle converting that value into the appropriate PyObject * . The syntax for return converters is similar to that of parameter converters. You specify the return converter like it was a return annotation on the function itself. Return converters behave much the same as parameter converters; they take arguments, the arguments are all keyword-only, and if you’re not changing any of the default arguments you can omit the parentheses. (If you use both$_{"as"}$ and a return converter for your function, the$_{"as"}$ should come before the return converter.) There’s one additional complication when using return converters: how do you indicate an error has occurred? Nor- mally, a function returns a valid (non-$_{NULL}$ ) pointer for success, and$_{NULL}$ for failure. But if you use an integer return converter, all integers are valid. How can Argument Clinic detect an error? Its solution: each return con- verter implicitly looks for a special value that indicates an error. If you return that value, and an error has been set ($_{PyErr_Occurred()}$ returns a true value), then the generated code will propagate the error. Otherwise it will encode the value you return like normal. Currently Argument Clinic supports only a few return converters: bool int unsigned int long unsigned int size_t Py_ssize_t float double DecodeFSDefault None of these take parameters. For the first three, return -1 to indicate error. For$_{DecodeFSDefault}$ , the return type is$_{const char *}$ ; return a$_{NULL}$ pointer to indicate an error. (There’s also an experimental$_{NoneType}$ converter, which lets you return$_{Py_None}$ on success or$_{NULL}$ on failure, without having to increment the reference count on$_{Py_None}$. I’m not sure it adds enough clarity to be worth using.) To see all the return converters Argument Clinic supports, along with their parameters (if any), just run$_{Tools/}$ clinic/clinic.py --converters for the full list. 15