Question about Pass-by-object-reference?

Ben Finney ben+python at
Wed Jul 23 08:25:12 CEST 2014

Steven D'Aprano <steve at> writes:

> On Wed, 23 Jul 2014 11:59:45 +1000, Ben Finney wrote:
> > fl <rxjwg98 at> writes:
> >> On Tuesday, July 22, 2014 8:27:15 PM UTC-4, Terry Reedy wrote:
> >> > Nothing is being 'passed'.
> >>
> >> Thanks, but I don't understand your point yet. Could you give me
> >> another example in which something is passed?
> > 
> > The point being made is that no values are is “passed” in a function
> > call. If you have learned that term from elsewhere, it doesn't apply
> > sensibly to Python.
> Hmmm. I don't know that I like that. I think that these two sentences 
> mean the same thing:
>     "Call the function with x as argument."
>     "Pass x to the function."
> They both describe what is being done, only from slightly different 
> points of view.

You're free to think that, but I'm agreeing with Terry that the
conflation is unwarranted and confusing in the attempt to explain what
is happening.

Rather, “Call the function ‘foo’ with ‘x’ as an argument” has no
implication that the argument ‘x’ travels anywhere, or is exclusively
located either inside the function or out of it, or any other inferences
that are invited by the statement “Pass ‘x’ to the function”.

So you may *intend* them to mean the same thing. But the terminology
comes with baggage, both from other programming languages and from
non-programming meanings of the English word “pass”. They don't
communicate the same thing.

> In mathematics, to call a function is a completely abstract action.

Right, and the terms aren't located anywhere we need to identify, they
don't travel anywhere, and “pass” isn't used to refer to them. These are
good reasons for avoiding the statement “pass a value ‘x’ to the
function ‘foo’”.

> But in programming languages, calling a function has concrete actions:
> certain things have to happen even before the function itself
> executes. What sort of things? Well, for starters, somehow the
> arguments need to be passed to the function

No. The function needs to *know what the arguments are*. Using the verb
“pass” to refer to an action which has nothing to do with motion through
any space is clearly confusing the matter here.

> If you say "nothing is being passed", then my response would be "Oh,
> you aren't calling the function at all? Or just calling it with no
> arguments?"

To which my response is “You're mistakenly conflating the above two

Steven D'Aprano <steve at> writes:

> On Tue, 22 Jul 2014 20:27:15 -0400, Terry Reedy wrote:
> > When you call a function, Python binds function parameter names to
> > argument objects in the function's local namespace, the same as in
> > name assignments. […] Nothing is being 'passed'.
> If nothing is being passed, how does the function know to bind 1 and
> 'x' to names a and b, rather than (say) this?
> a, b = 23, 'Surprise!"

Because the objects 1 and 'x' are made known to and made available to
the function. They're not passed because they don't go anywhere.

I acknowledge that “pass the value 1 to the function ‘foo’” is
entrenched and I'm not advocating to remove it, but it's foolish to
ignore that this term invites unwarranted inferences.

Heck, you have argued strongly that the whole “how are values passed in
Python?” question is rather misguided and can only be answered by
casting out assumptions about “pass”. I'm saying the mis-guidance comes
from using the verb “pass a value” for an action that doesn't involve
values going anywhere.

 \      “It is the integrity of each individual human that is in final |
  `\        examination. On personal integrity hangs humanity's fate.” |
_o__)               —Richard Buckminster Fuller, _Critical Path_, 1981 |
Ben Finney

More information about the Python-list mailing list