A question on modification of a list via a function invocation

Steve D'Aprano steve+python at pearwood.info
Mon Sep 4 10:20:25 EDT 2017


On Mon, 4 Sep 2017 01:11 pm, Rustom Mody wrote:

> Earlier
> Ben Bacarisse wrote:
>> The core of the idea is actually what the value-set of Python programs is --
> 
> Yes! That!!

Indeed.

Given the assignment:

x = 1


then I think we all agree that the value of x is 1. So far so good.

But then, in order to force the round peg of Python's actual behaviour into the
square hole of "pass by value", some people insist that while the value of x is
indeed 1, as we agreed above, it is also, simultaneously, some invisible,
unknowable, implementation-dependent "reference" that we cannot access in any
way without leaving the domain of the language itself.

(E.g. by hacking the interpreter, using ctypes, or taking advantage of
implementation-dependent hooks which are strictly outside of the language
itself, such as debugging hooks.)

In a way, it is an example of reductionism gone mad, as if a chemist insisted
that there are no people, animals or cars in the world, there are only
molecules.

(Of course this is silly. As all physicists know, there are no people, animals
or cars in the world, there are only quarks and electrons.)



> Parameter-passing models and nomenclature is really a red-herring

No, they are very relevant. They are all connected. But you cannot agree on what
the parameter passing models mean if you cannot even agree on what your
language's values are.

If you want to believe that the value of x above is something other than 1, then
you can conclude anything you like. And who knows, maybe you'll even find an
implementation of Python where it is true.

Personally, I believe that the value of x is actually a series of cytosine,
guanine, adenine and thymine nucleobases, and some day when Python runs on a
DNA computer I'll be proven right.

https://en.wikipedia.org/wiki/DNA_computing

*wink*



> Its the “== is id” mess that is at the base of the mess:

That is irrelevant.



> Simply put: pythonistas have no coherent/consistent sense of what python
> values are. And the endless parameter-passing-nomenclature arguments are just
> the fallout of that.

This is not a dispute unique to the Python community. Similar arguments take
place in the Java and Ruby communities, and I daresay many others.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list