Hi, in the modern era it makes much more sense to have 100 as a default.
Some would prefer 120, but 100 makes the most sense as not being too big of a change.
The main importance of black is indeed to be "uncompromising", and I feel for it to be future proof it is another reason to choose 100 over e.g. 80 or 88.
You must be joking.
Quoting you from the repo:
"You probably noticed the peculiar default line length. Black defaults to 88 characters per line, which happens to be 10% over 80. This number was found to produce significantly shorter files than sticking with 80 (the most popular), or even 79 (used by the standard library). In general, 90-ish seems like the wise choice."
You advise 90-ish (like Raymond mentioned) and you advise "uncompromising" (it'd be best if no one would need configuration). But the value is currently set to 88, unchallenged.
I hope you're the one who is joking with such a response and closing the issue.
If you are proposing a change to defaults in a prominent project, the onus on proving the disruption is worth it is on you. Your request doesn't have that, rather it's using adjectives that carry little information ("modern" is subjective). Hence my dismissive response.
Modern line length has little to do with how many columns fit on a 4K screen. You need to consider accessibility, existing research on optimal text widths for reading, ability to put multiple files side by side for review or editing (including line numbers and so on).
More importantly, consider that currently millions of lines of code are being formatted with Black as is. Changing the default would be a major breach of trust unless the new value is strongly better. Proving that is going to be hard.
I hope this clears things up a bit. I expect you to do your homework just as much as you expect me to do mine.
I'm just quoting this repo a lot. It's also stating that things are still breakable, which is why I'm still starting this discussion. Your argument "millions of lines being formatted" is not a good reason at this stage.
The 88 decision is unique to this project, it was added in a very early commit and does not stand.
Like you said, there has been a lot of research and I believe "90ish", on this day, would make 100 characters a better default.
Actually, I've been giving a lot of thought that characters per line is a bad measure anyway, and "max number of AST elements per line" is a better measure (probably giving different weights to different items).
Perhaps it can be made an official issue with a poll and people can decide democratically before black goes into a next phase? That sounds like an ideal setup for something with the aim of being uncompromising/setting a standard.
Please accept that this is a closed issue. We are not changing this without extensive research that would prove the new value is strongly better than the current default value. Having a vote on the matter is not a viable replacement for such research.
Is there a way to change the default line length? I have looked at the documentation but could not understand.
Put the value you wish to use in the configuration file for your project.
@alispa alternatively, there's also the --line-length command line arg
Is there a way to change the default line length?
Create a pyproject.toml with the content:
[tool.black]
line-length = 80
Most helpful comment
You must be joking.