Question about Pass-by-object-reference?

fl rxjwg98 at
Wed Jul 23 01:00:06 CEST 2014

On Tuesday, July 22, 2014 4:35:33 PM UTC-4, Peter Pearson wrote:
> On Tue, 22 Jul 2014 12:34:51 -0700 (PDT), fl <r at> wrote:
> When you say "def reassign(list)", that means "I'm defining a function
> to which the caller will pass one object, and within this function I'm
> going to refer to that object by the name 'list'."
> Then, when you say "list=[0,1]", that means "Create the object [0,1],

The above is what rebind? see below I cite.

> and assign to it the name 'list'."  At this point, there is no longer
> any name that refers to the object that the caller passed.

Here is I find on-line about "Arguments are passed by assignment."

"If you pass a mutable object into a method, the method gets a reference to that 
same object and you can mutate it to your heart's delight, but if you rebind the
reference in the method, the outer scope will know nothing about it, and after
you're done, the outer reference will still point at the original object."


More information about the Python-list mailing list