A question on modification of a list via a function invocation
Rustom Mody
rustompmody at gmail.com
Mon Sep 4 12:13:05 EDT 2017
On Monday, September 4, 2017 at 9:13:43 PM UTC+5:30, Steve D'Aprano wrote:
> On Tue, 5 Sep 2017 01:17 am, Rustom Mody wrote:
>
> > Anton gave a picture explaining why/how references are needed and to be
> > understood
>
> Antoon gave a picture demonstrating one model of Python's semantics.
>
> It's a nice model that has a lot going for it, in particular that it matches the
> most obvious implementation. But it doesn't describe *Python* semantics, it
> describes an overlap between Python the language and the implementation of the
> Python interpreter.
>
> In particular, consider the picture of a name binding to a value:
>
>
> +-----+
> | |
> | 5 |
> | |
> +-----+
> ^
> |
> <x>
>
>
> This picture has three entities, but only two of them exist in Python:
>
> - the object 5;
>
> - the name "x" (names are not values in Python at runtime, but they
> are entities which exist in Python source code at compile time).
>
> 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.
A common fallacy:
https://en.wikipedia.org/wiki/Begging_the_question
Python does not have references/pointers/whatever
∴ Python does not have references (or whatever you want to (not) call it)
More information about the Python-list
mailing list