mirror of https://github.com/python/cpython
Merge: #20135: FAQ entry for list mutation. (See also 90b07d422bd9.)
I accidentally merged this in 90b07d422bd9; this merge addresses the last review comments on the patch.
This commit is contained in:
commit
d034ece5b3
|
@ -473,7 +473,7 @@ There are two factors that produce this result:
|
||||||
|
|
||||||
After the call to :meth:`~list.append`, the content of the mutable object has
|
After the call to :meth:`~list.append`, the content of the mutable object has
|
||||||
changed from ``[]`` to ``[10]``. Since both the variables refer to the same
|
changed from ``[]`` to ``[10]``. Since both the variables refer to the same
|
||||||
object, accessing either one of them accesses the modified value ``[10]``.
|
object, using either name accesses the modified value ``[10]``.
|
||||||
|
|
||||||
If we instead assign an immutable object to ``x``::
|
If we instead assign an immutable object to ``x``::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue