Skip to content

Commit 9f20a12

Browse files
Docs: Argument Clinic: Add Background and Tutorial top-level sections (python/cpython#106904)
Add Background as a toplevel section with the following subsections: - Background - The goals of Argument Clinic - Basic concepts and usage Rename "Converting your first function" to Tutorial. Add anchors for Background, Tutorial, and How-to Guides: - :ref:`clinic-background` - :ref:`clinic-tutorial` - :ref:`clinic-howtos` Link to these from within the Abstract. Break the compatibility paragraph out of Abstract and make it a note. Co-authored-by: Ezio Melotti <[email protected]>
1 parent 5122701 commit 9f20a12

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

Doc/howto/clinic.rst

+27-9
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,20 @@ Argument Clinic How-To
1313

1414
Argument Clinic is a preprocessor for CPython C files.
1515
Its purpose is to automate all the boilerplate involved
16-
with writing argument parsing code for "builtins".
17-
This document shows you how to convert your first C
18-
function to work with Argument Clinic, and then introduces
19-
some advanced topics on Argument Clinic usage.
16+
with writing argument parsing code for "builtins",
17+
module level functions, and class methods.
18+
This document is divided in three major sections:
2019

21-
Currently Argument Clinic is considered internal-only
20+
* :ref:`clinic-background` talks about the basic concepts and goals of
21+
Argument Clinic.
22+
* :ref:`clinic-tutorial` guides you through all the steps required to
23+
adapt an existing C function to Argument Clinic.
24+
* :ref:`clinic-howtos` details how to handle specific tasks.
25+
26+
27+
.. note::
28+
29+
Argument Clinic is considered internal-only
2230
for CPython. Its use is not supported for files outside
2331
CPython, and no guarantees are made regarding backwards
2432
compatibility for future versions. In other words: if you
@@ -28,8 +36,14 @@ Argument Clinic How-To
2836
of CPython *could* be totally incompatible and break all your code.
2937

3038

39+
.. _clinic-background:
40+
41+
Background
42+
==========
43+
44+
3145
The goals of Argument Clinic
32-
============================
46+
----------------------------
3347

3448
Argument Clinic's primary goal
3549
is to take over responsibility for all argument parsing code
@@ -80,7 +94,7 @@ things with all the information you give it.
8094

8195

8296
Basic concepts and usage
83-
========================
97+
------------------------
8498

8599
Argument Clinic ships with CPython; you'll find it in ``Tools/clinic/clinic.py``.
86100
If you run that script, specifying a C file as an argument:
@@ -142,8 +156,10 @@ For the sake of clarity, here's the terminology we'll use with Argument Clinic:
142156
a block.)
143157

144158

145-
Converting your first function
146-
==============================
159+
.. _clinic-tutorial:
160+
161+
Tutorial
162+
========
147163

148164
The best way to get a sense of how Argument Clinic works is to
149165
convert a function to work with it. Here, then, are the bare
@@ -560,6 +576,8 @@ Let's dive in!
560576
Congratulations, you've ported your first function to work with Argument Clinic!
561577

562578

579+
.. _clinic-howtos:
580+
563581
How-to guides
564582
=============
565583

0 commit comments

Comments
 (0)