why cannot assign to function call

Mark Wooding mdw at distorted.org.uk
Fri Jan 9 21:46:06 CET 2009


Aaron Brady <castironpi at gmail.com> wrote:

> Possible compromise.  You can think of functions as mutation-only.
> You pass the object, and it gets a new (additional) name.  The old
> name doesn't go in.  </compromise>

Huh?  That doesn't explain circular data structures at all, unless your
idea of `name' is unrelated to the identifiers the programmer has typed
and in fact is the same as what I'm calling a reference.

> Regardless, IMO, references don't add any explanatory power; they just
> make you feel cocky that you know what they are.

No, they're essential to understanding sharing and circular data.

> M: If 'fun()' returned a reference, you would be able to assign to it.

[mdw]: Why would you think that you can assign to a reference?  You
assign to variables, not references.

> -- Why can't I assign to a function call?
> -- Python variables are references only.

You may have missed this, but I explained at least twice: variables are
bound to `slots' or `locations'; locations, in Python, store references
to values; references are not values.

But I answered this lot ages ago.  I'm still dealing with the fallout
because of my approach, though.

> In other words, Mark and Joe, cut to the chase.  You're shirking.

I'm trying to explain somewhat complex concepts in defence of my thesis.
This is not intended to be an answer to the original poster: the
discussion has become considerably more technical since then.

-- [mdw]



More information about the Python-list mailing list