Let’s say I have the following Python code:
if conditionOne():
if conditionTwo():
foo = bar
foo += 1
bar -= 2
If I later remove conditionTwo, I would like to dedent the three lines of the block so it looks consistent with all my other code. Normally I’d just reach for =% (my primary language is C++), but that won’t work here, so I tried 3== on the first line of the block. That led to this:
if conditionOne():
foo = bar
foo += 1
bar -= 2
That’s not what I was looking for. I could have gone with 3<< and gotten a better result, but that’s not a command I normally use. I’d rather not have to remember special indentation commands just for Python. In the spirit of Don’t Make Me Think, is there a way to make the = filters work with Python code as I expect?
Whereas in C or C++ indenting a program does not affect its behaviour, in Python it could really, since indentation is part of the flow control.
Therefore in Python a program with a different indentation will have a different behaviour and for an editor it is impossible to guess whether the developer wanted to indent a line (in an inner scope) or not.
Hence auto-indenting features of your editor are designed to work with C-like languages, not Python.