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

Marko Rauhamaa marko at pacujo.net
Mon Sep 25 10:26:36 EDT 2017


Chris Angelico <rosuav at gmail.com>:

> On Mon, Sep 25, 2017 at 7:41 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
>> In Python, all expressions evaluate pointers.
>
> And that's an assertion that isn't backed by anything in the Python
> specification. Where do you get that all Python expressions are
> pointers?

That's not what I said. I said all expressions *evaluate to* pointers.

As for the specification, it doesn't make use of the word "pointer:"

   <URL: https://docs.python.org/3/reference/simple_stmts.html#assignme
   nt-statements>

Instead, it uses (English) expressions like:

   is bound to the object
   is rebound

when talking about "names" (aka variables).

It also uses circular definitions when talking about dicts and lists:

   That object is then asked to assign the assigned object to the given
   attribute

   the sequence is asked to assign the assigned object to its item with
   that index.


The (English) expression:

   The name is bound to the object.

is just another way of saying:

   A pointer to the object is stored in the variable.


Of course, I'm using terminology that is not conventional in Python
circles. However, I'm doing it to demonstrate that there's nothing
particularly different between Python's assignment semantics and those
of, say, Pascal. Python's assignment semantics are wholly contained by
those of Pascal.


Marko



More information about the Python-list mailing list