which a is used?

Dwight Hutto dwightdhutto at gmail.com
Mon Sep 24 21:50:56 EDT 2012


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()


Yielding:

david at david-desktop:~$ python answer_to_email.py
1
20
david at david-desktop:~$


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com



More information about the Python-list mailing list