Why does the following code produce indentation error in the Python console (version 2.6.5 in my case)? I was convinced the following was a valid piece of code:
if True:
print '1'
print 'indentation error on this line'
If I insert a blank line between the if-block and the last print, the error goes away:
if True:
print '1'
print 'no error here'
I am little bit puzzled, from the documentation it seems to me that blank (or only-white-space) lines should not make any difference. Any hints?
The problem is due to the usage of the Python console, not the Python language. If you put everything in a method, it works.
Example: