4 ms·
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 t
by chimpburger 7y ago
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.
- applecrazy 7y agoNot 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.
- gpm 7y agoAnd 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.
- saagarjha 7y agoOf course, you can omit the braces if there’s a single statement (though I personally never do this).
- gpm 7y agoSure, 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.
- saagarjha 7y agoI think it’s a fair point to bring up given that many people actually do write their code that way.