4 ms·
A language that uses parentheses does not preclude one from also using indentation to convey code structure. In fact, this is usually standard practice. Python
by addicted 5y ago
A language that uses parentheses does not preclude one from also using indentation to convey code structure. In fact, this is usually standard practice.
Python, however, does indeed preclude one from using additional signifiers of code structure beyond indentation.
And in practice you don’t type out parentheses. You put in a single opening parentheses and your editor will add the closing parentheses and add the appropriate indentation (and if desired, newlines) for you. In practice the only difference in typing is typing a single ( character vs a single <tab> character.
All that being said, this is the very definition of bike shedding, so it’s really not a factor when picking one language over another.
- stavros 5y agoI don't understand what you mean. How are parentheses relevant? Also, personally I hate the parenthesis completion, it gets in the way more than it helps. By "parentheses" do you mean "brackets"? If so, sure, you can use indentation along with brackets, but why am I now using two things? With Python, all I need to do is backspace every once in a while, to signify the end of indentation, which is very easy to do.
- wizzwizz4 5y ago> By "parentheses" do you mean "brackets"? I choose to believe that this means S-expressions.
- horsawlarway 5y agoAs a real reply - I can copy code marked up with parens and brackets from basically any source (no matter how it's indented or how whitespace is handled) and my linter will automatically understand and format it nicely. In an indentation language - If I copy a chunk of code that's nested more or less deeply than the section I'm currently working on, I have to manually replace whitespace everywhere. Sometimes the linter is smart enough, sometimes it's not.
- wizzwizz4 5y agoIf your editor keeps the selection once you paste, you can just hit tab / shift + tab until the indentation's correct. And there's no counting “did I copy the correct number of close brackets”. I actually find Python easier in this regard, even in editors where I have to re-select everything I just pasted.