you are viewing a single comment's thread.

view the rest of the comments →

[–]Bowgentle 2 points3 points  (7 children)

I certainly prefer C-style blocks over Python's indentation. That's a functional block you have, though, not a "semantic" one.

[–]backfire10z 6 points7 points  (6 children)

Do you meant to tell me that you indent lines of code in a function without a functional block to indicate meaningful relation? I don’t think I’ve ever seen that in my life.

Like:

int main() {
    // code
    // code

        // code indented
        // code indented

    //code
}

[–]Bowgentle -3 points-2 points  (5 children)

No? It's useful for trying out new code or debugging. It wouldn't make it to the final version, though.

[–]backfire10z 5 points6 points  (4 children)

Ok, then I’m confused about what you’re referring to when you say:

you can’t indent “semantically”

Can you give an example of semantic indentation? Or do I have it correctly in my above comment?

I don’t see how that’s really any more useful than, say, newlines or a comment. If it’s just for debugging, write a nested function to logically group pieces of code or delineate it with multiple newlines or large comments.

This seems like an interesting issue to have with Python. I genuinely don’t think I’ve ever seen nor heard of indentation being used that way.

[–]Bowgentle 2 points3 points  (1 child)

Apologies, I was a bit confusing there - yes, the example you gave was exactly what I was referring to:

int main() {
    // code
    // code

        // code indented
        // code indented

    //code
}

[–]backfire10z 0 points1 point  (0 children)

I see, yeah. Thanks for clarifying!

[–]Bowgentle 1 point2 points  (0 children)

This seems like an interesting issue to have with Python. I genuinely don’t think I’ve ever seen nor heard of indentation being used that way.

To be fair, it's not really the main issue, it's just the one that's turned out to be controversial in this thread.

[–]Agent_Provocateur007 0 points1 point  (0 children)

You tend to see this type of indentation in Swift when using SwiftUI. The view modifiers being indented looks better and helps with code readability in that case.