4 ms·
Did you actually try Black on a line like this?
by ambivalence 8y ago
Did you actually try Black on a line like this?
- quietbritishjim 8y agoI must admit I didn't. I felt confident it was restricted to adding and removing whitespace because the README says at the start: > Black ignores previous formatting and applies uniform horizontal and vertical whitespace to your code. I now see it does sometimes modify non-whitespace characters e.g. later in the README it mentions: > In [certain] cases, parentheses are removed when the entire statement fits in one line I'm not in a position to test black out right now (I can't run Python on the computer I'm posting this comment on). I'd be curious to know what it does on the code I posted, and on over-length comments and string literals.
- freyir 8y agoI tried it. Black doesn't seem to touch long strings or comments. It just leaves you with "line too long" errors that you can clean up yourself. For your code example, see my comment above.
- freyir 8y agoIn: left[a_rather_long_key][a_rather_long_key] = right[a_rather_long_key][a_rather_long_key][a_rather_long_key] Out: left[a_rather_long_key][a_rather_long_key] = right[a_rather_long_key][ a_rather_long_key ][a_rather_long_key]