function parameter scope python 2.5.2

J Kenneth King james at agentultra.com
Fri Nov 21 09:55:30 EST 2008


alex23 <wuwei23 at gmail.com> writes:

> On Nov 21, 9:40 am, J Kenneth King <ja... at agentultra.com> wrote:
>> Of course, providing a shallow (or deep as necessary) copy makes it
>> work, I'm curious as to why the value passed as a parameter to a
>> function outside the class is passed a reference rather than a copy.
>
> You're passing neither a reference nor a copy, you're passing the
> object (in this case a list) directly:
>
> http://effbot.org/zone/call-by-object.htm

Ah, thanks -- that's precisely what I was looking for.

I knew it couldn't be a mistake; I just couldn't find the documentation
on the behaviour since I didn't know what it was called in the python
world.

Cheers.



More information about the Python-list mailing list