Thanks! Tried to tag the python code according to the instructions.
I modified your code slightly so that it works in Python 2.7
The difference is that I want to call method a from within the class. As you see in my firsst example, the
intendation of the call "a('Call a-method')" is inside the class, not outside. My first example works if I comment line #13 (b('aa')).
I modified your code slightly so that it works in Python 2.7
The difference is that I want to call method a from within the class. As you see in my firsst example, the
intendation of the call "a('Call a-method')" is inside the class, not outside. My first example works if I comment line #13 (b('aa')).
class TestClass: def __init__(self, name): self.methoda(name) def methodb(self, name): print("---b---{}".format(name)) def methoda(self, name): print("---a---{}".format(name)) self.methodb("aa") self.methoda('Call a-method from within class') # This doesn't. TestClass("Call a-method") # This works