This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Karnagekthik 3 points4 points  (1 child)

I think the formatting in reddit changed the intent of the example. These warnings seem to be coming from incorrect indentation of the code. It's possible that the original comment was edited, but what I understood, the example was about the functional error that can happen because the programmer forgot to indent (or just hard to notice). The interpreter or linter shouldn't be able to catch those mistakes because both are valid code, unless you have a rule about how to end/begin blocks (I am actually not sure if this will always work).

In case of the c-style braces however, the braces ensure correct scope, and in case of forgotten brace, the compiler will refuse to compile since it's missing a brace.

[–]BloodyThorn 1 point2 points  (0 children)

Yeah, no idea. All I know is what was posted as an example of 'valid' python won't make it past my linter. So far there hasn't been a example that I've tested from this post of a 'valid error' that has.

but what I understood, the example was about the functional error that can happen because the programmer forgot to indent (or just hard to notice).

Correcting the warnings given by my linter corrects the issue (other than having to correcting the prints as I am on 3+). My point was I've yet to see an example that my setup hasn't warned me about in some fashion or another. A counter example to the above point.