Kaydet (Commit) 12dc0d96 authored tarafından R David Murray's avatar R David Murray

#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.
üst c31f12d1
......@@ -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``::
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment