Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #15512 > unrolled thread
| Started by | Alan G Isaac <alan.isaac@gmail.com> |
|---|---|
| First post | 2013-09-22 06:41 +0000 |
| Last post | 2013-09-22 06:41 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: list mutability (very basic question) Alan G Isaac <alan.isaac@gmail.com> - 2013-09-22 06:41 +0000
| From | Alan G Isaac <alan.isaac@gmail.com> |
|---|---|
| Date | 2013-09-22 06:41 +0000 |
| Subject | Re: list mutability (very basic question) |
| Message-ID | <l1m3ea$cdh$1@smc.vnet.net> |
On 9/21/2013 10:15 AM, Bob Hanlon wrote:
> Attributes[Set]
> {HoldFirst, Protected, SequenceHold}
Thanks, but I'm still unclear:
why does ``{0}[[1]]=1`` raise an error?
As a point of reference for my confusion,
Python behaves in a way I find more intuitive:
``[0,1][1]=0`` does not raise an error.
(This becomes an interesting difference when
we get to argument passing in Mathematica, where HoldFirst
becomes useful as a way to allow "in place" modification.)
Back to Mathematica, am I understanding correctly that after
``Set[Part[x,1],1])`` that x still references the
same location in memory? How can I easily see that?
(E.g., in Python, I would us the ``id`` function.)
Thanks,
Alan Isaac
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web