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

Seriously. Python Black is a godsend. I don't have to waste brain cells on formatting minutiae, just right-click and go "format my code, please." It's consistent, it works, and IDGAF about the details.

The only formatting that drives me up the wall is people using K&R braces in C# or Java. It's not 1970 anymore, and we're not all typing on green-screen terminals. It's like people fetishizing vim or emacs over modern IDEs.



You know what annoyed me as a C/C++ programmer? People using Microsoft style braces... But OK, if you are using Microsoft-Java, then Microsoft rules apply.

AFAIK there is no rule in K&R requiring no braces for single-line blocks. In that situation, braces are optional.

The K&R style was hugely influential on Java and many other languages, it has nothing to do with green-screen terminals (I used those, as well as white and amber), it is just a style. I also moved on from vi, and use IntelliJ and Sublime most of the time.

The only difference between K&R braces and Java braces is that they combine lines on if-else. The Java guys did it because it enabled them to fit more code on to overhead slides. Overhead slide projectors predate green-screen terminals BTW...


..huh? But either way, should you ever be annoyed by K&R again next time you work with C#, you can trivially change it by setting csharp_new_line_before_open_brace = none in .editorconfig and running dotnet-format tool against solution files.


K&R doesn't just mean the opening brace isn't on its own line, it also means single-line blocks have no braces at all. Always using braces but not putting the opening one on its own line is 1TBS (not the best name, but I don't know what else it's called).


You can omit them too (at the risk of legibility in some conditions).

All these are configurable (and not enforced by default but you can definitely do so with .editorconfig).

It is also fairly popular in C# to use expression-bodied members where they have just a single expression/statement e.g.

    class Test {
        public int Property => 42;
        public void Method() => Console.WriteLine(42);
    }


Yeah, I think OP's point is that nobody should be omitting braces in this day and age. Maybe there's a setting to force the use of braces too.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: