The subtleties of the interactions between the concepts of references
to objects, mutable objects, immutable objects, shallow copy of
objects and deep copy of objects continue to surprise me!
On Fri, May 25, 2018 at 1:27 AM, Steven D'Aprano wrote:
> On Thu, May 24, 2018 at 10:33:56PM -0500, boB S
On Thu, May 24, 2018 at 10:33:56PM -0500, boB Stepp wrote:
[...]
> I am having trouble correlating the behavior of the one-dimensional
> case with the two-dimensional case. The result of [1, 2]*3 seems to
> be an actual list, not a replication of the references to the items in
> the original list,
On Thu, May 24, 2018 at 10:39:17PM -0700, Danny Yoo wrote:
> Each value in Python has an associated numeric address associated to it.
No they don't :-)
Each object in Python has an arbitrary numeric ID associated with it.
The Python language has no supported way to get the address of an
object
Each value in Python has an associated numeric address associated to it.
We can probe for it:
https://docs.python.org/3/library/functions.html#id
For example:
#
>>> x = [1, 2, 3]
>>> y = x[:]
>>> id(x)
139718082542336
>>> id(y)
139718082556776
##