Am 25.09.2012 03:47 schrieb Dwight Hutto:

But within a class this is could be defined as self.x within the
functions and changed, correct?


class a():
        def __init__(self,a):
                self.a = a

        def f(self):
                print self.a

        def g(self):
                self.a = 20
                print self.a


a = a(1)
a.f()
a.g()

Yes - this is a different situation. Here, the "self" referred to is the same in all cases (the "a" from top level), and so self.a can be used consistently as well.


Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to