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

Antoon Pardon antoon.pardon at rece.vub.ac.be
Mon Sep 25 13:54:41 EDT 2017


On 25-09-17 19:31, Chris Angelico wrote:
> On Tue, Sep 26, 2017 at 3:04 AM, Antoon Pardon
> <antoon.pardon at rece.vub.ac.be> wrote:
>> On 25-09-17 16:29, Marko Rauhamaa wrote:
>>> Antoon Pardon <antoon.pardon at vub.be>:
>>>
>>>> Op 25-09-17 om 15:16 schreef Marko Rauhamaa:
>>>>> No, I'm not. I'm talking about pointers in the abstract sense, both in
>>>>> case of Python and Pascal. Neither language gives any hint as to the
>>>>> physical nature of the pointer.
>>>>
>>>> Yes you are. Python doesn't have pointers at the language level. So if
>>>> you start talking pointers you are talking about implementations
>>>> however abstract.
>>>
>>> It is difficult to say what is the "native" Python term for the thing.
>>> "Binding," maybe? The language spec fails to give it a name.
>>>
>>> However, when comparing different languages, you had better unify the
>>> terminology or you'll be confused by purely terminological issues.
>>
>> Fine, you have two mappings, a mapping from names to identities and a
>> mapping from identities to values. In languages like C, Pascal, ...
>> an assignment changes the mapping between the identities and the
>> values. In languages like Python, Smalltalk, ... an assignment
>> changes the mapping between the names and the identities.
> 
> If by "identity" you mean the integer values returned by id(), then
> nope, you're still wrong - there is no mapping from identities to
> values. There is a mapping from name to object/value, and from an
> object, you can determine its identity. If you like, there's a mapping
> from values to identities, but not the other way around.

I'm describing this at a conceptual level.

> Unless, of course, you can find something in the Python documentation
> that supports this two-step indirection?

The fact that the Python documentation describes its sematics differently
doesn't contradict that this is a useful model.

-- 
Antoon Pardon.





More information about the Python-list mailing list