Finding the instance reference of an object

Terry Reedy tjreedy at udel.edu
Mon Nov 10 13:32:37 EST 2008


Joe Strout wrote:
> On Nov 10, 2008, at 8:30 AM, Terry Reedy wrote:
> 
>>> That hinges on what exactly is meant by "changes to
>>> the arguments".
>>
>> Mutating them, like Python does, which is why calling Python CBV leads 
>> people to write buggy code.
>>
>> >In Python it can only mean assigning
>>> directly to the bare name -- anything else isn't
>>> changing the argument itself, but something else to
>>> which the argument refers.
>>
>> Hogwash.  The argument is the object and mutable objects can be 
>> changed as seen by the caller.
> 
> By that definition, Java, REALbasic, C++, and VB.NET are all 
> call-by-reference too (even when explicitly using the "ByVal" keyword in 
> RB/VB.NET).  This will come as quite a shock to the designers and users 
> of those languages.
> 
> For what it's worth, I think Greg (double-quoted above) has it exactly 
> right.  The argument in any of these languages is an object reference; 
> changing the object and changing the object reference are two different 
> things.




More information about the Python-list mailing list