3 ms·
But the language spec for Python is what allows for this, not the compiler. \n is just the magic character now except now we also need a \ to make multiline exp
by taormina 2y ago
But the language spec for Python is what allows for this, not the compiler. \n is just the magic character now except now we also need a \ to make multiline expressions. It’s all trade offs, compilers are not magic
- scotty79 2y agoScala then. Semicolons are optional but you still can have them if you need them
- lblume 2y agoThe obvious example would have been JavaScript, but nobody wants to say something positive about JavaScript...
- scotty79 2y agoJavaScript has some specific and unique issues. Some silly choices (like auto inserting of semi-colons after empty return) and source code routinely, intentionally getting mangled by minification.
- glitchc 2y ago> but nobody wants to say something positive about JavaScript... For obvious reasons...
- BeetleB 2y ago> now except now we also need a \ to make multiline expressions. You never need the backslash in Python to make multiple expressions. There's always a way to do multiline using parentheses. Their own style guidelines discourage using backslash for this purpose.
- taormina 2y agoAnd you can also do it with triple quotation marks if strings are involved, but it’s still more work for the compiler that someone explicitly did, it’s not magic.
- BeetleB 2y agoPlain strings work fine. Python has the same behavior as C: If two strings separated by whitespace, it concatenates them. So if I have a long string, I start with an open parenthesis, type one string, go to the next line, and another, and so on over several lines. Python sees it all as one string. Very readable.