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

greg greg at cosc.canterbury.ac.nz
Fri Nov 21 19:59:13 EST 2008


Aaron Brady wrote:

> But wait, is that true assignment?

It's assignment, but it's not really copying an object. No new
objects are being created -- rather, some of the items within
the lhs object are being rebound to already-existing objects.

It would be possible for the lhs object's __setitem__ method
to be defined so that it created new objects, but then it
would be the __setitem__ method doing that, not the assignment
statement itself.

None of this is really relevant anyway, since the assignment
that call-by-value implies is always to a bare local name, and
there is no way that kind of assignment can ever create a new
object.

-- 
Greg



More information about the Python-list mailing list