Finding the instance reference of an object

Douglas Alan doug at alum.mit.edu
Mon Oct 27 13:45:48 EDT 2008


Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:

> I understand that Python's object and calling semantics are exactly the 
> same as Emerald (and likely other languages as well), and that both 
> Emerald and Python are explicitly based on those of CLU, as described by 
> by Barbara Liskov in 1979:
>
>     "In particular it is not call by value because mutations of
>     arguments performed by the called routine will be visible to the
>     caller. And it is not call by reference because access is not
>     given to the variables of the caller, but merely to certain
>     objects."

It is quite true that Python's calling semantics are the same as
CLU's, and that CLU called these semantics "call by sharing".  It's
not quite true that CLU invented these calling semantics, however.
They were the calling semantics of Lisp long before CLU existed.  I'm
not sure that Lisp had a name for it, however.  Lisp people tended to
refer to all variable assignment as "binding".

I agree with those who object to calling the Python/CLU/Lisp calling
semantics as either "call by value" or "call by reference", which is
why I've been a bit dismayed over the years that the term "call by
sharing" hasn't caught on.  When this terminology is used, the meaning is
quite unambiguous.

It should be noted that many other mainstream languages now use call
by sharing.  It's not at all the least peculiar to Python.  Such
languages include Java, JavaScript, Ruby, C#, and ActionScript.

|>oug



More information about the Python-list mailing list