4 ms·
I prefer the braces over END not because of the character count but because my brain can't avoid reading "end" when I read the code, while closing braces don't
by hota_mazi 10y ago
I prefer the braces over END not because of the character count but because my brain can't avoid reading "end" when I read the code, while closing braces don't cause a word to pronounced in my mind.
Also, just like you, I find that closing cascade of ENDs in nested statements is visual noise.
- pmontra 10y agoA cascade of end or a cascade of } is a bad smell about the code. I try my best to avoid that. Python has a solution to that problem but I think it's worse than the problem. end and } never gave me as many bugs in 30 years as having to reindent in Python did in one year.
- innocentoldguy 10y agoI like Python's relevant whitespace. It forces sloppy coders to organize their code in a more readable fashion. People who use tabs throw a wrench into the works, of course, but forcing them to fix the issues they've caused typically ensures it won't happen again. I have written Python code since version 1.9 was first released, back in the 1990s, and I've worked on many large Python teams where we never ran into any issues with whitespace at all. We all set our tabs to 4 spaces, adhered to PEP8 formatting, and everything went as smoothly as any other language. I think it may just be what you're used to too.
- innocentoldguy 10y agoThat is an interesting reason. It may seem small, but I think it is a perfectly valid point. I'm of the opposite opinion, but for similar reasons. I type using the Dvorak layout, and typing curly braces is a bigger pain in the nipple than typing "end." For me, "end" also makes reading code blocks easier, because it looks like the end of a paragraph. In other words, the fact that it does read like a sentence makes it stand out more for me than curly-braces do; especially when coders, who obviously have no style, put the opening curly-brace on the same line as the function definition or control loop. Hehe. I think it is interesting to contemplate the subjective aspects of languages and syntax preferences. Probably not productive, but interesting none the less.
- pmontra 10y agoSpeaking of subjectivity, if (condition) { ... } is the only readable option :-) if (condition) { ... } drowns the code in a sea of (subjective) noise. There are many other variants https://en.wikipedia.org/wiki/Indent_style#Placement_of_braces https://en.wikipedia.org/wiki/Indent_style#Placement_of_brac... and wars have been fought over them. There are pros and cons for most of them. My tradeoff is the K&R style. I think editors can automatically convert among styles nowadays. The only thing that matters is consistency.