[Tutor] dictionaries, objects and scoping...
john at fouhy.net
Tue Jan 22 03:32:21 CET 2008
On 22/01/2008, John Morris <jrmorrisnc at gmail.com> wrote:
> I thought each class got it's own namespace and this sharing of mutable
> objects is confusing me.
Each class gets its own namespace, but names are different from
objects. For example:
>>> x = [1, 2, 3]
>>> y = x
[1, 2, 3, 4]
In this case, x and y are both different names for the same object.
Classes increase the name space, but they don't change the fact that
in python, assignment is just giving something a new name.
More information about the Tutor