From b766f8693cd825df6c62fe9b64c4a16f99e99c7f Mon Sep 17 00:00:00 2001 From: Maciej Olko Date: Thu, 14 Sep 2023 23:06:00 +0200 Subject: [PATCH 1/2] gh-101100: Fix Sphinx warnings in `tutorial/controlflow.rst` --- Doc/tools/.nitignore | 1 - Doc/tutorial/controlflow.rst | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/tools/.nitignore b/Doc/tools/.nitignore index 39a10992193ffc..184cd14a711fd6 100644 --- a/Doc/tools/.nitignore +++ b/Doc/tools/.nitignore @@ -152,7 +152,6 @@ Doc/reference/datamodel.rst Doc/reference/expressions.rst Doc/reference/import.rst Doc/reference/simple_stmts.rst -Doc/tutorial/controlflow.rst Doc/tutorial/datastructures.rst Doc/tutorial/introduction.rst Doc/using/cmdline.rst diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index 4bcc3768111ccd..f4e7df9d1bbb6b 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -534,7 +534,7 @@ This example, as usual, demonstrates some new Python features: Different types define different methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define your own object types and methods, using *classes*, see :ref:`tut-classes`) - The method :meth:`~list.append` shown in the example is defined for list objects; it + The method :meth:`!list.append` shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is equivalent to ``result = result + [a]``, but more efficient. @@ -1046,7 +1046,7 @@ Function Annotations information about the types used by user-defined functions (see :pep:`3107` and :pep:`484` for more information). -:term:`Annotations ` are stored in the :attr:`__annotations__` +:term:`Annotations ` are stored in the :attr:`!__annotations__` attribute of the function as a dictionary and have no effect on any other part of the function. Parameter annotations are defined by a colon after the parameter name, followed by an expression evaluating to the value of the annotation. Return annotations are From 1e532235ba064ce55d0ef4539a7c80c0c94d856d Mon Sep 17 00:00:00 2001 From: Maciej Olko Date: Thu, 21 Sep 2023 08:33:51 +0200 Subject: [PATCH 2/2] Doc/tutorial/controlflow.rst: remove module prefix from append() method reference Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> --- Doc/tutorial/controlflow.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst index f4e7df9d1bbb6b..aa9caa101da40a 100644 --- a/Doc/tutorial/controlflow.rst +++ b/Doc/tutorial/controlflow.rst @@ -534,7 +534,7 @@ This example, as usual, demonstrates some new Python features: Different types define different methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define your own object types and methods, using *classes*, see :ref:`tut-classes`) - The method :meth:`!list.append` shown in the example is defined for list objects; it + The method :meth:`!append` shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is equivalent to ``result = result + [a]``, but more efficient.