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?
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor