Finding the instance reference of an object

greg greg at
Tue Oct 28 03:58:10 CET 2008

Steven D'Aprano wrote:

> By common usage and technical definition, C is call by value. Argument 
> passing in Python does not behave like C. So why insist that Python is 
> also call by value?

Whether it behaves like C is not the test.

Let's look at the definitions of the terms:

(1) Call by value: The actual parameter is an expression. It is
     evaluated and the result is assigned to the formal parameter.
     Subsequent assignments to the formal parameter do not affect
     the actual parameter.

(2) Call by reference: The actual parameter is an lvalue. The
     formal parameter becomes an alias for the actual parameter,
     so that assigning to the formal parameter has the same
     effect as assigning to the actual parameter.

Seems to me that (1) describes exactly how parameter passing
works in Python. So why insist that it's *not* call by value?


More information about the Python-list mailing list