I'm wrong or Will we fix the ducks limp?
BartC
bc at freeuk.com
Thu Jun 9 06:53:50 EDT 2016
On 09/06/2016 10:46, Antoon Pardon wrote:
> Op 09-06-16 om 09:36 schreef Steven D'Aprano:
>> Your example demonstrates object mutation, not assignment.
>
> Generally assignment and mutation don't contradict each other.
> So IMO the cause is the same, a mutation. In some languages you
> can mutate your variable through an assignment and in others you
> can't.
I think this is what is confusing you.
Mutation is like repairing or customising my car.
Full assignment is like buying a new car.
The two are very different, even though they might involve the same "="
operator.
Python object references work like the registration (license) plate on a
car. Whatever you do via that, it will be the same car.
Full references require the address of the house.
--
Bartc
More information about the Python-list
mailing list