Finding the instance reference of an object

greg greg at cosc.canterbury.ac.nz
Fri Oct 31 07:27:19 CET 2008


Dale Roberts wrote:
> Are you
> saying that C++ is capable of using the Call By Reference idiom, but C
> is not, because C does not have a reference designation for formal
> function parameters?

Call by reference is not an "idiom", it's a *language
feature*.

Pascal has it (using "var"), VB.NET has it (using "ByRef"),
C++ has it (using "&"). C does not have it, because there is
no syntax in the language for it. Neither does Python.

You can use an idiom in C to get the same effect, but this
is not the same thing as the language having it as a feature.

> You cannot look a C++ programmer straight in the eye and say that
> "Python uses Call By Value, Period", without also informing them that
> "Python variables can ONLY EVER hold object references - that is the
> only "value" they can ever hold".

But he had darn well better learn that anyway, otherwise he's
going to have massive problems programming in Python that
don't have anything to do with parameter passing!

-- 
Greg



More information about the Python-list mailing list