mirror of https://github.com/python/cpython.git
bpo-38558: Link to further docs from walrus operator mention in tutorial (GH-16973)
This commit is contained in:
parent
49932fec62
commit
5807efd4c3
|
@ -148,6 +148,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?
|
||||
-----------------------------------------------
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue