A question on modification of a list via a function invocation

Chris Angelico rosuav at gmail.com
Tue Sep 5 10:09:24 EDT 2017


On Tue, Sep 5, 2017 at 11:11 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz> wrote:
> Steve D'Aprano wrote:
>>
>> The third entity is the reference linking the name to the object (the
>> arrow).
>> This isn't a runtime value in Python, nor is it a compile time entity that
>> exists in source code. It is pure implementation, and as such, exists
>> outside
>> of the Python domain.
>
>
> The fact that there is a connection between the name and the
> object is very much part of Python's abstract semantics.
>
> There are different ways to implement that connection, but
> *any* implementation of Python has to include *some*
> representation of it.

Sure. But let's suppose you're building a Python implementation on top
of a language that has a perfectly good implementation of dict already
built for you. Literally every other namespace can be represented with
a dictionary, and the name:value association is that reference. Is the
reference *itself* a runtime value? No; you can't pick it up and move
it around - all you'll do is dereference it and get the value itself.
(Or you'll work with the name, as a string. That can sometimes serve
as a pseudo-reference.) Is it a compile time entity? Not directly
(assignment statements imply them, but they aren't themselves the
references). So Steve's comment is still correct.

ChrisA



More information about the Python-list mailing list