Finding the instance reference of an object

greg greg at
Fri Oct 31 01:44:48 CET 2008

Gabriel Genellina wrote:
> En Tue, 28 Oct 2008 00:58:10 -0200, greg <greg at>  
> escribió:
>> (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.
> Those definitions are only applicable to unstructured, primitive types,  
> where the only relevant operations are "get value" and "assign value".
> Structured types provide other operations too - like selection 
> (attribute  get/set in Python).

But that isn't what "assigning to the formal parameter" means --
it only means assigning directly to the parameter *name*.

> It is unspecified on both definitions 
> above what  happens in those cases.

That's true, but it's outside the scope of the parameter passing
mechanism to define what happens in those cases. That's down to
the data model being used by the language and the semantics of
assignment in general.


More information about the Python-list mailing list