Antoon Pardon <antoon.par...@rece.vub.ac.be>: > Op 25-09-17 om 11:41 schreef Marko Rauhamaa: >> Antoon Pardon <antoon.par...@vub.be>: >> >>> the semantics of an assignment depends on the language >> I've only seen one kind of assignment in the general-purpose >> programming languages I know, maybe with the exception of Prolog and >> Rust. > > I disagree. In languages like Pascal an asignment mutates the target > that the left hand refers to, by copying over the value from the right > side. In languages like python an asignment lets the target refer to a > new entity.
In Python, assignment "mutates the target" as well. It's only that in Python, the target is always a pointer. Here's proof (up to isomorphism): >>> x = object() >>> y = object() >>> id(x) 139719622467712 >>> x = y >>> id(x) 139719622467728 Meaning. Before: +---------- x ----------+ | 139719622467712 | +-----------------------+ After: +---------- x ----------+ | 139719622467728 | +-----------------------+ So we can see the contents of x have been mutated. Marko -- https://mail.python.org/mailman/listinfo/python-list