no pass-values calling?

Neil Cerutti mr.cerutti at gmail.com
Wed Jan 16 14:14:23 CET 2008


On Jan 16, 2008 7:58 AM,  <cokofreedom at gmail.com> wrote:
> On Jan 16, 1:21 pm, "Neil Cerutti" <mr.ceru... at gmail.com> wrote:
> > In the following function, a is rebound with an assignment statement,
> > while b is mutated, i.e., changed, with an assignment statement.
> >
> > def f(a, b):
> >     a = 12
> >     b.value = 14
> >
> > Argument a will never be changed, while argument b will be. Python's
> > argument passing semantics are extremely simple. It's the assignment
> > statement that's tricky: some assignments mutate/change objects, and
> > some only rebind names.
>
> So basically the scope is the reason for confusion a lot of the time?

No, my hypothesis is that Python's assignment statement semantics are
the tricky part--once you understand them, the utter simplicity of
Python's argument passing semantics will be evident.

-- 
Neil Cerutti <mr.cerutti+python at gmail.com>



More information about the Python-list mailing list