Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

When comparing different languages it becomes more of a measure of the relative abstraction levels of languages. The exact same program will have hundreds (or thousands) of times more LOC in Assembly than in Python.


Not only that, the LOC heuristic depends on the verbosity of the language. Java, for example, is more verbose, than say, Python, even though you’re close in abstraction level.


And just syntax decision.

    if (x) {
        y
    }
    else {
        z
    }

    if x:
        y
    else:
        z
Assuming x and y are 1 line but long enough expressions you don't want to use a trinary operator (available in both) the python is 2/3rds the length of the c because of bracketing. Obviously cherry picked, but I bet these differences add up.


Of course, you can omit the braces if there’s a single statement (though I personally never do this).


Sure, and you can put the else on the same line as the end of the if block even without doing that. Or you could make the difference bigger by putting the opening brace on a newline.

I wrote the style of C that I actually write, but it's probably not fair for me to label it as a property of just the language.


I think it’s a fair point to bring up given that many people actually do write their code that way.


I agree, I hope I didn't come across otherwise, just wanted to clarify why I wrote it like that.


Or even use allman / gnu where opening braces are also on their own line.


Yes, but those people clearly have issues ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: