Hacker News new | past | comments | ask | show | jobs | submit login

I think it's really a people problem:

Black will mindlessly split long lines into shorter, and my coworkers will just leave them as is. The results are eye bleedingly awful.

I hope most black proponents expect people to look at the generated code and change things until it looks decent?

Of course this problem is inherent in a tool that is autoformatting rather than warning, and seems to me to indicate a mentality that code is meant to be read by computers, not humans.




I think some of this is just that you have strong personal opinions which are somewhat out of the norm. I have Black split long lines but the results are never what I’d call awful and I’d increasingly class that as a code-smell indicator since the cases where I haven’t been happy with the results were generally unnecessarily complex lines which could be split to be more readable.

I would also flip your last sentence completely: computers don’t have problems reading code of any style. Auto-formatting is so humans don’t burn time adjusting to different styles or, worse, failing to parse them the same way as a compiler.


You seem to be sitting on two chairs here.

The split of the long lines aren't bad, but they are also bad because the long lines are inherently too complex.

Of course some times our broken up lines are too complex, and should ideally be restructured, but...

1. The mechanical way Black does it is rarely the best way to decomplexify things.

2. Often the long line wasn't complex at all. It just contained a simple but long string. Line length is a weak measure of code complexity, but as a dumb script, it's all Black can use.

That said, my main beef is really with the 88 char line length. If it was 120 or 140, I wouldn't like Black either, but I'd only be kinda annoyed. Coupled with 4 char indentations, 88 s an absurdly small space to fit code in, when we have the biggest screens in history. It's an incomprehensible madness to me.

Not sure what your final section says. I hope it's not that humans should learn to read code just like computers do?

To me, one of the most important quotes about our job is this:

“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.”


FWIW, Black now allows line-length customization via the `--line-length` argument.


Yeah, we actually looked at that today, and I'm impressed by how it repairs what it tore apart in "88" mode.

We might change things up and I might be OK with my 'black life after all.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: