why cannot assign to function call

Mark Wooding mdw at distorted.org.uk
Wed Jan 14 10:51:10 CET 2009

Aaron Brady <castironpi at gmail.com> wrote:

> On Jan 13, 5:06 pm, Mark Wooding <m... at distorted.org.uk> wrote:
> snip
> > I'm going to move away from the formal semantics stuff and try a
> > different tack.  Here's what I think is the defining property of
> > pass-by-value (distilled from the formal approach I described earlier,
> > but shorn of the symbolism):
> >
> >   The callee's parameters are /new variables/, initialized /as if by
> >   assignment/ from the values of caller's argument expressions.
> In other words, the same as assignment in that language.

It's the same as assignment of /values/ to /fresh variables/.  It's
important to specify that argument expressions are fully evaluated, and
that nothing gets overwritten in the process.

So the difference between Python and C is that C copies values during
assignment, but Python doesn't.  Therefore the argument passing works
the same way.

> > Because its argument passing works the same way as its assignment.
> That would be called pass-by-assignment.  But you've just postponed
> explaining yourself.  Stop delegating and work.

Huh?  I'm really at a loss to know what you want me to do.

I can't help it if people are confused over the phrase `pass-by-value',
beyond trying to explain what it means using clear definitions.  The
`value' part means that argument expressions are /evaluated/ (turned
into values), which forces applicative-order semantics rather than (say)

-- [mdw]

More information about the Python-list mailing list