Can a method in one class change an object in another class?
Harlin Seritt
harlinseritt at yahoo.com
Sun Mar 6 06:00:44 EST 2005
Here's what I came up with:
#objtest.py
class first:
def __init__(self):
a = 'a'
self.a = a
print self.a
def update(self):
print 'initially, a is', self.a
self.a = second(self.a)
print 'afterwards, a is', self.a.call(self.a)
class second:
def __init__(self, a):
pass
def call(self, a):
a = 'aa'
return a
if __name__ == '__main__':
app = first()
app.update()
Not sure if this is what you are wanting though.
More information about the Python-list
mailing list