Skip to content

Commit 505eede

Browse files
Docs: Argument Clinic: Group guides about default values (#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
1 parent a293fa5 commit 505eede

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
@@ -564,22 +564,6 @@ How-to guides
564564
=============
565565

566566

567-
How to use symbolic default values
568-
----------------------------------
569-
570-
The default value you provide for a parameter can't be any arbitrary
571-
expression. Currently the following are explicitly supported:
572-
573-
* Numeric constants (integer and float)
574-
* String constants
575-
* ``True``, ``False``, and ``None``
576-
* Simple symbolic constants like ``sys.maxsize``, which must
577-
start with the name of the module
578-
579-
(In the future, this may need to get even more elaborate,
580-
to allow full expressions like ``CONSTANT - 1``.)
581-
582-
583567
How to to rename C functions and variables generated by Argument Clinic
584568
-----------------------------------------------------------------------
585569

@@ -965,8 +949,8 @@ There's also special support for a default value of ``NULL``, and
965949
for simple expressions, documented in the following sections.
966950

967951

968-
How to use the ``NULL`` default value
969-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
952+
The ``NULL`` default value
953+
^^^^^^^^^^^^^^^^^^^^^^^^^^
970954

971955
For string and object parameters, you can set them to ``None`` to indicate
972956
that there's no default. However, that means the C variable will be
@@ -976,8 +960,24 @@ behaves like a default value of ``None``, but the C variable is initialized
976960
with ``NULL``.
977961

978962

979-
How to use expressions as default values
980-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
963+
Symbolic default values
964+
^^^^^^^^^^^^^^^^^^^^^^^
965+
966+
The default value you provide for a parameter can't be any arbitrary
967+
expression. Currently the following are explicitly supported:
968+
969+
* Numeric constants (integer and float)
970+
* String constants
971+
* ``True``, ``False``, and ``None``
972+
* Simple symbolic constants like ``sys.maxsize``, which must
973+
start with the name of the module
974+
975+
(In the future, this may need to get even more elaborate,
976+
to allow full expressions like ``CONSTANT - 1``.)
977+
978+
979+
Expressions as default values
980+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
981981

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

0 commit comments

Comments
 (0)