OK, I could reproduce your error by installing idle for Python 3.3.0. I'm sorry that we all suspected that you didn't include the whole error message because IDLE doesn't produce more than a red SyntaxError: invalid syntax. There is nothing wrong with your code, nor your class definition.
I guess, you're just pasting the code as-is into your Python shell window. This way, things won't work because the indentation doesn't get produced correctly.
Try pasting the line class Abc: into your shell window and press Enter. You will see that IDLE automatically indents the next line with a tab. This is the correct indentation for the following line, so when you enter it, you need to paste def a(self): without any extra indentation! If you paste line by line and reduce the indentation by one where needed and terminate your class definition with an extra Enter, your code gets executed correctly.
However, you should better use the following method:
- Paste your file into an editor and save it as
whatever.py
- In IDLE, choose
File -> Open and open this file
- A new window opens with your source code inside.
- Now, press
F5 or say Run -> Run Module
- Your code will be executed and the result displayed in the Python Shell.
Or, even better, use Python directly in the shell by executing python whatever.py directly.
SyntaxErrorhere,self.ais not actually calling anything, instead this syntax returns a function, that when called evaluatesAbc.a(self). You want bothself.b()andself.a()in your code.