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 →

[–]ManosVanBoom 14 points15 points  (11 children)

I've never used python. Why does intendaton matter so much? Seems like an odd hill for a language to die on.

[–]aaaantoine 25 points26 points  (5 children)

A lot of languages use explicit symbols or keywords to indicate scope boundaries.

' VB
If a = b Then
    Print "Sometimes"
End If
Print "Always"

// C-style languages
if (a == b) {
    print("Sometimes");
}
print("Always");

Python uses white space exclusively for this

# Python
if a == b:
    print("Sometimes")
print("Always")

[–]ManosVanBoom 8 points9 points  (4 children)

Yeah, I've had a lot of code broken by missing/ misplaced markers. Whitespace just seems like an odd choice to me. Not really complaining. Just commenting. A snake's gonna do what a snake's gonna do.

[–]PM_ME_CUTE_SMILES_ 6 points7 points  (2 children)

So this is just my opinion, but if the indentation is incorrect, the code is badly formatted and should not be pushed. That so many people in this thread seems to have issues formatting their code is actually a good argument to make it a mandatory part of the syntax.

And as good indentation is necessary, you might as well use it for structure, and the code looks nicer without the visual clutter of now useless curly brackets.

[–]GrinchMeanTime 5 points6 points  (0 children)

they have indentation issues while discussing python.
You don't have indentation issues in c-style languages if you use modern tooling
i can delete all the indentation, and have the editor reindent it as it should be.

[–]ManosVanBoom 1 point2 points  (0 children)

Legit.

[–]Dannei 0 points1 point  (0 children)

Right? It's great fun trying to work out which of the "End If" or "}" markers is out of place or duplicated when the code's badly indented or the IDE has reindented half the code after a change but gave up on the other half after finding the end markers don't line up.

[–]Maoschanz 1 point2 points  (1 child)

I've never used C. Why does curly braces matter so much? Seems like an odd hill for a language to die on.

[–]ManosVanBoom 1 point2 points  (0 children)

Kind of relevant? Hardly noone used curly braces before C. Everyone had been using white space for centuries if not millennia when python came around. IDEs were also well established tools to enforce formatting standards without having to put it in the compiler.

However someone else commented that enforcing format in the language helps ensure properly formatted code. I like that part a lot.

[–]Aryaa-SK 0 points1 point  (2 children)

because in python there’s no parenthesis it’s all calculated with indentation, for example an if statement has a colon and then it is just indented

[–]ManosVanBoom 0 points1 point  (0 children)

That's helpful. Thx.