3 ms·
def fun(): for x in xs: if a: b c There's no way for an editor to know where to re-indent c to. You have to cycle thr
by okasaki 12y ago
def fun():
for x in xs:
if a:
b
c
There's no way for an editor to know where to re-indent c to. You have to cycle through the indents manually.
- seanmcdirmid 12y agoAuto indent, tab, and shift tab are your friends. Really, it isn't that bad, considering the curly brace alternative is even worse from an effort perspective.
- okasaki 12y agoTo each their own. I came to C++ from Haskell and found braces to be superior (except visually).
- vertex-four 12y agoHow did you end up with c there, honestly? It's not a thing that's ever happened to me.
- nothrabannosir 12y agoPerhaps I misunderstand, but vim, not a particularly uncommon editor, treats backspace at the start of a line by removing one indent level. So, you're at `b`, you hit enter: next line, same indent level. Now you hit backspace: indent level matches `if`. Again: indent level matches `for`. Type c, there it is. If you had curly braces, you'd use } instead of backspace. Literally the same number of keystrokes, no? Or were you talking about something else and did I misunderstand?