3 ms·
Yes. Most of the projects now use black https://github.com/ambv/black https://github.com/ambv/black
by sametmax 8y ago
Yes. Most of the projects now use black https://github.com/ambv/black https://github.com/ambv/black
- quietbritishjim 8y agoThe problem that black had last time I saw it on hacker news is that it only inserts whitespace. Unlike braces-and-semicolon languages, that is sometimes not enough to format code well. For example, given the following line: x[1][4] = a[2] + b[4] Black will format like either of these: x[1][ 4] = a[2] + b[4] x[1][4] = a[ 2] + b[4] But not like either of these, unless you insert the brackets yourself: x[1][4] = ( a[2] + b[4]) x[1][4] = (a[2] + b[4]) Maybe this sounds like just one little problem but I think it's a fundamental flaw. I have seen the result of a Python formatter (not Black but had the same problem) applied to a couple of files and it's a total mess. I'd take inconsistent column widths over that any day. I asked the creator of black about it and he was pretty dismissive.
- Rotareti 8y agoI use yapf and in such cases backslashes work fine: x[1][4] =\ a[2] + b[4]