In <0778f257-d36c-4e13-93ea-bf8d448c8...@b15g2000yqd.googlegroups.com> Paul Boddie <p...@boddie.org.uk> writes:
>On 8 Jul, 16:04, kj <no.em...@please.post> wrote: >> >> =A0 <identifier> =3D <expression> >> >> and not to those like, for example, >> >> =A0 <identifier>[<expression>] =3D <expression> >> >> or >> >> =A0 <identifier>.<identifier> =3D <expression> >> >> The former are syntatic sugar for certain namespace modifications >> that leave objects unchanged. =A0The latter are syntactic sugar for >> certain object-modifying method calls that leave namespaces unchanged. >Almost. The latter can modify namespaces - the objects themselves - >but through properties or dynamic attribute access, they may choose >not to modify such a namespace. Really, we can phrase assignment (=3D) >as follows: ><thing> =3D <expression> # make <thing> refer to the result of ><expression> >Here, <thing> has to provide something that can be made to refer to >something else, such as a name within a namespace - the first and last >of your cases - or an item or slice within a sequence - the special >second case which is actually handled differently from the other >cases. Thanks for this correction. OK, so, scratching from my original post the case <identifier>.<identifier> = <expression> (as being a special case of <identifier> = <expression>), still, to the extent that I understand your post, the "=" in x = 1 means something fundamentally different (in terms of Python's underlying implementation) from the "=" in y[0] = 1 No? >You could stretch this analogy by treating sequences as >signposts holding many signs, each adjustable to point to something >different. Notionally, yes, I can see that, but there's no counterpart of this analogy at the level of Python's implementation. The "x" above is a sign, as you put it, i.e. an entry in a namespace, but "y[0]" is, in essence, a method call. kj -- http://mail.python.org/mailman/listinfo/python-list