I've noticed a few questions (such as this) where the code has no indentation at all (or is missing a code block), but is in a whitespace sensitive language. In this case another user updated the indentation in the code snippet in a way that seems obvious. However, I'm concerned that any incorrectness in the poster's original code might not have carried over (for example, they could have accidentally indented multiple lines in the except block).

How should I edit the original question? Should I include an indentation fix if it seems obvious? Or should I simply ask the person who posted the question to fix it themselves?

And what about cases where another user has edited the indentation? Should it be reverted?

Looking at an answer about changing case in a case sensitive language it seems to imply that I shouldn't update the indentation, but doesn't suggest how to handle someone else adjusting the indentation.

Finally, should I apply a different standard between questions and answers? Or should the both be either comment only or edited?

1 Answer 1


One should definitely take care in editing such posts, especially given that the indentation could be the problem in the first place. Just some general guidance I would suggest:

  • Consider checking the Edit form to see the original formatting the user tried to input; that might give you a strong hint.
  • If it seems unlikely that indentation errors are the cause of the problem, because you know what is, go ahead and edit it.
  • If it seems unlikely, but you aren't sure what is the cause of the OP's trouble, consider editing it and leaving a comment asking if your indentation fix matches their real code.
  • If you aren't sure either way, just ask the OP if the code is indented as displayed.

For answers; if it seems clear that the answer is addressing the problem in question, and that the indentation when done correctly would work correctly, go ahead and edit it. Otherwise, perhaps consider the items I noted above.

  • 4
    Inspecting the edit form is usually the winner here, tabs are sometimes an issue, and often adding just one new line is all it takes to fix.
    – hayd
    Feb 25, 2013 at 22:13
  • @hayden I've moved that item to the top of the list; when I think about it, that's usually what I check first and what convinces me the strongest. People usually paste the code in correctly, but just don't use the site formatting features correctly thereafter. Feb 25, 2013 at 22:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .