Official definition of call-by-value (Re: Finding the instance reference...)

Duncan Booth duncan.booth at invalid.invalid
Fri Nov 21 04:11:58 EST 2008


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

> On Fri, 21 Nov 2008 03:32:25 +0000, Steven D'Aprano wrote:
> 
>>> Rather it seems to me that the essence of the idea they had in mind
>>> is that call-by-value is equivalent to assignment.
>> 
>> You've just *assumed* that assignment in Algol 60 doesn't involving
>> copying. Based on the very little I know about Algol, I think that is
>> a very unsafe assumption. I know significantly more about Pascal, and
>> in Pascal, assignment *is* copying.
>> 
>> (I wait now with bated breath for somebody to point out some Python
>> implementation or feature where assignment doesn't make a copy...)
> 
> Ah crap, I meant *Pascal*. Python of course doesn't copy objects when
> you assign them.
> 
> 
I think you meant "Python of course doesn't copy objects when you rebind 
names". Python can (and sometimes does) make copies of objects when you 
assign them, , but only if the assignment involves something other than 
simply rebinding a name. e.g.

a[:] = [1, 2, 3]



-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list