mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
#20135: FAQ entry for list mutation. (See also 6375bf34fff6.)
I accidentally committed this in 6375bf34fff6; this changeset addresses the last review comments on the patch. This is a perennial question and something someone opens a ticket for probably every other month or so, so I'm surprised we didn't already have a FAQ entry for it. The original patch was written by M. Votz, refined first by Ezio Melotti and further refined by me.
This commit is contained in:
parent
c31f12d196
commit
12dc0d96e0
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
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``::
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue