I want to use vscode and jupyter for interactive python programming. Everything works find except that cells/blocks are only recognized when they are not indent or if the code is not indented. Previously, I used spyder where this is possible.
I like this behavior because it is useful for debugging und development when you have longer class or function definitions (that are indented) but just want to run a couple of lines from the class/function interactively.
I have tried the official python extension and the Don Jayamanne juypter extension. None allowed the desired behavior.
Update: I just figured out that different python versions behave differently in this respect. With python 3.6.6 and 3.7.2 the indents raise an error while with python 3.6.7 or 3.6.8 the indent is ignored and the cell is executed. Is there an explanation why different versions behave differently or explicit setting to handle this?
#%%
print('This works')
#%%
print('This does not work, as it raises an indent error')
print('Update: This works in python version 3.6.7 or 3.6.8')
#%%
print('This does not work, as it is not recognized as a cell/block')