Finding the instance reference of an object

Craig Allen callen314 at gmail.com
Tue Nov 4 09:42:28 EST 2008


>
> If the assert statement fails (and it does), then no copy was made and
> Python is not call-by-value.
>
> So Python is not call-by-value, and it's not call-by-reference, so ...
> either Python doesn't exist, or it uses a different calling convention.
>

coming from C/C++ Python seemed to me call by reference, for the
pragmatic reason you said, modificaitons to function arguments do
affect the variable in the caller.  The confusing part of this then
comes when immutable objects are passed in. You still get a reference,
but rather than complaining if you change the value of that parameter
at might happen if immutible was "const" and the code was const-
correct. Honestly I understand how this can change the callBy paradigm
I don't see it that way (though I've duly remembers call-by-sharing
and call-by-object) for communication purposes).  I see it as a factor
of the way variable names are rebound, that is, the "quirk" I remember
is not about how entities are passed to functions, but the quirk of
how python deals with modifications to "immutibles".

That is, python lets you change object references pointing to
immutibles, which looks like changing the value referenced,  by
rebinding.

So is that objectionable?



More information about the Python-list mailing list