]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-38558: Link to further docs from walrus operator mention in tutorial (GH-16973)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 3 Feb 2020 17:17:17 +0000 (09:17 -0800)
committerGitHub <noreply@github.com>
Mon, 3 Feb 2020 17:17:17 +0000 (09:17 -0800)
(cherry picked from commit 5807efd4c396d5718325e21f5a14e324a77ff77c)

Co-authored-by: Adorilson Bezerra <adorilson@gmail.com>
Doc/faq/design.rst
Doc/tutorial/datastructures.rst

index 81c0f474ac16241fb4780e15d8fc4d1a7f887994..e7921baf242f52c1813b8f35dcfcbe3d9b633d31 100644 (file)
@@ -146,6 +146,8 @@ variables and instance variables live in two different namespaces, and you need
 to tell Python which namespace to use.
 
 
+.. _why-can-t-i-use-an-assignment-in-an-expression:
+
 Why can't I use an assignment in an expression?
 -----------------------------------------------
 
index 2f7afb088f3bbbffe6aee9d9975163f17e000204..0edb73ad736919dfe3e941e721b97d52ae9d0078 100644 (file)
@@ -676,9 +676,10 @@ to a variable.  For example, ::
    'Trondheim'
 
 Note that in Python, unlike C, assignment inside expressions must be done
-explicitly with the walrus operator ``:=``. This avoids a common class of
-problems encountered in C programs: typing ``=`` in an expression when ``==``
-was intended.
+explicitly with the
+:ref:`walrus operator <why-can-t-i-use-an-assignment-in-an-expression>` ``:=``.
+This avoids a common class of problems encountered in C programs: typing ``=``
+in an expression when ``==`` was intended.
 
 
 .. _tut-comparing: