Ferdinand Sousa wrote:
Hi
Some weeks back I had been following the thread "Why can't assign to
function call". Today, I saw the "function scope" thread, and decided I
should ask about the behaviour below:
>>>
# Simple va
People get a confused because if you pass a mutable object inside a def
function and mutate that object the changes /are/ propagated outside--
because now you have a name inside the function and a name outside the
object both pointing to the same object.
Since tuples are immutable, I guess pass
On Mon, Feb 2, 2009 at 10:02 PM, Ferdinand Sousa
wrote:
> Hi
>
> Some weeks back I had been following the thread "Why can't assign to
> function call". Today, I saw the "function scope" thread, and decided I
> should ask about the behaviour below:
>
>
> Guess the simple types show the expected behaviour (even though they are
> technically instances of existing classes). The user defined classes seem to
> be references/shallow copies.
I prefer to avoid the term "reference" when talking about Python semantics,
because it tends to make a lot of
Hi
Some weeks back I had been following the thread "Why can't assign to
function call". Today, I saw the "function scope" thread, and decided I
should ask about the behaviour below:
>>> #
Simple variables
>>>p=55
>>> q=p
>>> q