I frequently answer questions on the python
tag and one thing that happens (all the time) is that code is not correctly indented. In python, the indenting of code blocks matters:
if foo:
bar()
elif other_foo:
other_bar()
is a SyntaxError
. In this case, it is completely obvious that the user meant to do:
if foo:
bar()
elif other_foo:
other_bar()
The question isn't about getting a SyntaxError
, it's about something else, so it's pretty clear that this is just a copy/paste problem and not knowing how to clearly format code on SO. Here's the question -- with the plethora of statements here on Meta about NEVER EDIT CODE IN A QUESTION, does that apply to this as well? To fix it, I would do nothing other than format the code so that it produces the behavior that is mentioned in the rest of the question.
Of course, indenting of code is just an example. mis-spelled variable names are another thing which I see occasionally.
My current policy is to leave a comment asking the OP to fix the problem. Is that the correct way to go about this, or should I edit?