Official definition of call-by-value (Re: Finding the instance reference...)
castironpi at gmail.com
Fri Nov 21 10:56:01 CET 2008
On Nov 21, 3:11 am, Duncan Booth <duncan.bo... at invalid.invalid> wrote:
> Steven D'Aprano <st... 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]
No, that's not assignment, it's syntactic sugar for a __setslice__
call. No copies here.
More information about the Python-list