1. "Call/pass by XXX" terminology usually refers to language semantics, not underlying implementation details. In that respect, the call-stack mechanism is largely orthogonal here.
2. According to this oft-cited article (in the context of Java), passing an address under the hood is not sufficient to make a language call-by-reference. http://javadude.com/articles/passbyvalue.htm - AFAIK Python would "fail" the "Litmus test".
(EDIT - clarify what's not call-by-ref)
Dog toby = new Dog("Toby");
public static void replaceDogWithToby ( Dog d )
{
d = toby;
}
public static void main ( String[] args )
{
Dog d = new Dog("Lassie");
replaceDogWithToby(d);
System.out.println(d);
}
In Pascal, this will print Toby: var
toby:tDog;
procedure replaceDogWithToby ( var d:tDog );
begin
d := toby;
end;
var
lassie:tDog;
begin
{code to initialize toby and lassie here}
d := lassie;
replaceDogWithToby(d);
writeln(getDogName(d));
end.
The first is call by object (or call by sharing, in my book). The second is call by reference. The behavior is totally different.Python uses references implicitly without ever defining the term, so it's essential to talk about the high level semantics in this case. A Python reference (implied) differs greatly from a C++ reference in that it can be rebound with the assignment operator. If you're thinking about references in C++ terms then Python will confuse you. It's important to call out the differences.
Usually there is one global hash-table, and a local hash table. Everything (every function, every object, every string is stored once, depending on the calling situation. So passing a reference to a object is passing the reference to that one global object, until you change it, or make a local copy of it. That sounds really strange and in a way is it. It also means, that your list of objects, will not contain duplicates. It means no useless work is done to copy data.
The model involved borrows basically from the concept of lazy loading and flat copys. Do work only when needed. Super difficult to explain to new users without CS background.