Finding the instance reference of an object [long and probably boring]

Aaron Brady castironpi at gmail.com
Mon Nov 10 16:30:01 EST 2008


On Nov 10, 2:45 pm, Arnaud Delobelle <arno... at googlemail.com> wrote:
> Aaron Brady <castiro... at gmail.com> writes:
> > Do you ever say to someone, "'Napoleon' will no longer refer to
> > Nelson.  It is this lobster now instead", while you are holding a
> > lobster?
>
> Not explicitly.  But in the course of conversation I might refer to
> Napoleon, meaning Napoleon Bonaparte (1769 - 1821) or Napoleon III (1808
> - 1873).  There would then be an implicit 'rebinding' of the name Napoleon.
>
> > My point is that the assignment operation is rare in natural language.
>
> My point was to get away from a model for Python which was built on its
> likely implementation and to hint that we can build one using the naive
> concept of 'name for a thing' instead.  IOW, 'call by value' is an
> unnecessary obfuscation of what *actually* happens (even though it may
> describe accurately the artifacts employed by an implementation)
>
> I'm glad that you thought about it!

I agree with Terry that all calling is call-by-value, and Steven that
all calling is call-by-bit-flipping.  I agree with Joe that call-by-
object is a special case of call-by-value.

I thought of another way Python's passing method could be
implemented.  Parameters are passed as namespace-name pairs, and every
time a variable occurs, it's looked up in the namespace it's in.  If
it's changed (concurrently) in the outer scope, a copy is made into
the inner scope.  If it's changed in the inner scope, a new entry is
added there.

It's still call-by-value (and bit-flipping) on some level, in the
trivial sense.  What else is it?




More information about the Python-list mailing list