In this thread all of the Python code is not indented, making it hard to read.

Is there some way to fix this? I see it quite a bit at stackoverflow.

  • 10
    Why? Because the person who posted the code didn't bother to indent it correctly. Yeah, that happens a lot - most new comers have no idea about formatting. – Oded Nov 27 '12 at 19:45
  • 6
    I see indentations... Is there a specific spot where it's missing? – animuson Nov 27 '12 at 19:45
  • 6
    What browser are you using and which version? IE7 perhaps? – Bart Nov 27 '12 at 19:57
  • Would it be possible to auto-indent Python(java etc)? A good future idea!!! – Caffeinated Nov 27 '12 at 20:30
  • 1
    @Adel: I don't think it would be possible to auto-indent Python. Indentation is how structure is indicated in Python (the way C uses { and }). If the indentation is missing, there's no reliable way to recreate it. – Keith Thompson Nov 28 '12 at 4:12
  • I'm using IE6 (corporate choice, not mine!) – Terrence Brannon Nov 28 '12 at 15:42
  • Related: StackOverflow seems to use 4-column tabs, while many non-Windows editors use 8. Users often post code they think is properly formatted, only to have it come out all wrong. (FWIW, the official Java standard says use 8). It's especially confusing because the editor (at least in my browser) uses 8-column tabs, even though SO then displays with 4-column. When I edit a post, I just convert to spaces to eliminate the confusion. – Edward Falk May 22 '13 at 0:08

On Stack Overflow, the ability to suggest edits to improve a post is one of the most powerful features of the platform. If you see a post with code that's improperly formatted, click the edit link below the post, and fix the formatting yourself.

Anyone can suggest edits, even new or anonymous users. However, if you have at least 2000 reputation you can edit any question or answer, without needing approval.

This is how we're able to make sure that the initial, ugly state of a question doesn't have to remain just another random snapshot of the Internet at a specific moment in time. With the edit feature, each post is cleaned up, polished, and spit-shined so that it looks awesome and helps many future visitors.

One word of caution, if you do edit a post, don't just fix the code formatting. Be sure to fix all of the problems that you see. This includes spelling, grammar, and other formatting. Your edit should be as substantial as possible for maximum effect, since a post can only be edited a certain amount of times before it's converted to community wiki, and since an edited post is bumped back to the top of the main page. If you don't fix all of the problems in a post, your edit may be rejected by the community.

  • unless, of course, the edits are rejected for being too radical or too trivial... – Chris Gerken Nov 28 '12 at 3:08
  • Good point, @ChrisGerken. I addressed that point as well. – jmort253 Nov 28 '12 at 4:06

You must log in to answer this question.

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