Question about Pass-by-object-reference?

Steven D'Aprano steve at pearwood.info
Thu Jul 24 07:05:02 CEST 2014


On Thu, 24 Jul 2014 03:22:16 +0000, Steven D'Aprano wrote:

[...]
> I stated that "call function with argument x" and "pass x to function"
> mean the same thing.

Oh, a thought comes to mind. There is a sense in which "calling a 
function with argument x" is slightly different from "passing x to a 
function": when you call a function, the compiler has to do at least two 
things: 

1) record enough information somewhere (usually on a call stack) so 
   it can return back to the caller once the function returns;

2) record in some manner the arguments to the function where the 
   function can get to them ("pass the arguments").

So if you want to be pedantic and argue that calling does more than 
passing arguments, I'll have to concede the point that you are 
technically correct. But in the context of discussing the treatment of 
arguments passed to the function when you call a function, I think that's 
a distinction that matters not.


-- 
Steven



More information about the Python-list mailing list