Skip to content

Commit 0c47ed7

Browse files
[3.11] Docs: Argument Clinic: Group guides about default values (GH-106872) (#106873)
Docs: Argument Clinic: Group guides about default values (GH-106872) Previous ToC layout (excerpt): - How to use symbolic default values ... - How to assign default values to parameter - How to use the ``NULL`` default value - How to use expressions as default values New layout: - How to assign default values to parameter - The ``NULL`` default value - Symbolic default values - Expressions as default values (cherry picked from commit 505eede) Co-authored-by: Erlend E. Aasland <[email protected]>
1 parent 3855344 commit 0c47ed7

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

Doc/howto/clinic.rst

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -556,22 +556,6 @@ How-to guides
556556
=============
557557

558558

559-
How to use symbolic default values
560-
----------------------------------
561-
562-
The default value you provide for a parameter can't be any arbitrary
563-
expression. Currently the following are explicitly supported:
564-
565-
* Numeric constants (integer and float)
566-
* String constants
567-
* ``True``, ``False``, and ``None``
568-
* Simple symbolic constants like ``sys.maxsize``, which must
569-
start with the name of the module
570-
571-
(In the future, this may need to get even more elaborate,
572-
to allow full expressions like ``CONSTANT - 1``.)
573-
574-
575559
How to to rename C functions and variables generated by Argument Clinic
576560
-----------------------------------------------------------------------
577561

@@ -954,8 +938,8 @@ There's also special support for a default value of ``NULL``, and
954938
for simple expressions, documented in the following sections.
955939

956940

957-
How to use the ``NULL`` default value
958-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
941+
The ``NULL`` default value
942+
^^^^^^^^^^^^^^^^^^^^^^^^^^
959943

960944
For string and object parameters, you can set them to ``None`` to indicate
961945
that there's no default. However, that means the C variable will be
@@ -965,8 +949,24 @@ behaves like a default value of ``None``, but the C variable is initialized
965949
with ``NULL``.
966950

967951

968-
How to use expressions as default values
969-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
952+
Symbolic default values
953+
^^^^^^^^^^^^^^^^^^^^^^^
954+
955+
The default value you provide for a parameter can't be any arbitrary
956+
expression. Currently the following are explicitly supported:
957+
958+
* Numeric constants (integer and float)
959+
* String constants
960+
* ``True``, ``False``, and ``None``
961+
* Simple symbolic constants like ``sys.maxsize``, which must
962+
start with the name of the module
963+
964+
(In the future, this may need to get even more elaborate,
965+
to allow full expressions like ``CONSTANT - 1``.)
966+
967+
968+
Expressions as default values
969+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
970970

971971
The default value for a parameter can be more than just a literal value.
972972
It can be an entire expression, using math operators and looking up attributes

0 commit comments

Comments
 (0)