Call by binding [was Re: [Tutor] beginning to code]

Marko Rauhamaa marko at pacujo.net
Mon Sep 25 05:41:28 EDT 2017


Antoon Pardon <antoon.pardon at 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.

So the assignment is the same everywhere, only the evaluation model
varies. In classic C, expressions evaluate to integers, double-precision
floating-point numbers or pointers. In Python, all expressions evaluate
pointers.

For example, in C, the expression

    1 + 2

takes two integers and produces a third one. By contrast, the same
Python expression takes two pointers and produces a third one (while
possibly generating a number of objects in the process).

Analogously, C lvalues can store various types of value. In Python, all
"lvalues" store a pointer.

I haven't wanted to use the word "value" above because it is ambiguous
and confusing in the context of this discussion.


Marko



More information about the Python-list mailing list