Does it have something to do with: http://effbot.org/pyfaq/why-are-default-values-shared-between-objects.htm
And if so can anyone explain it a bit for me, I'm being slow tonight. I thought each class got it's own namespace and this sharing of mutable objects is confusing me. Thanks. On Jan 21, 2008 9:16 PM, John Morris <[EMAIL PROTECTED]> wrote: > class Foo: > '''Represents a foo''' > def __init__(self, name): > '''Initializes the person's data''' > self.name = name > print '(Initializing %s)' % self.name > self.ot = Bar(self.name) > print '(After Other - %s)' % self.name > > class Bar: > def __init__(self, name): > self.name = name > print 'Other', self.name > self.name.pop('srv') > print 'Other (Changed)', self.name > > dict = { "srv" : "why", "goo" : "sticky" } > foo = Foo(dict) > print foo.name > > > Why does the pop in the Bar class nuke the srv k & v from Foo.name as > well? > > -- John Morris [EMAIL PROTECTED] "Do nothing which is of no use." -- Miyamoto Musashi <a href="http://profile.mygamercard.net/nerdality"> <img src="http://card.mygamercard.net/gbar/abyss/nerdality.gif" border=0> </a>
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor