Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> you have to cycle through all sensible indentations

What? My editor indents stuff for me as per PEP8. I don't have to think about it. Why do you?



  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.


Perhaps 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?


How did you end up with c there, honestly? It's not a thing that's ever happened to me.


Auto 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.


To each their own. I came to C++ from Haskell and found braces to be superior (except visually).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: