Black – Uncompromising Python code formatter
1–10 of 251 posts
Re: Black – Uncompromising Python code formatter
#2I like the idea of auto-formatting code, like go does.
Though I think I prefer autopep8
Re: Black – Uncompromising Python code formatter
#3I've been using this for a couple of weeks and its a been really nice to remove the constant mental overhead of structuring code. it also makes you think about structuring functional blocks into more manageable, bite-sized chunks which is easier to understand. 10/10 would recommend
Re: Black – Uncompromising Python code formatter
#4I use black every day. It's pretty good. The hours you save on pointless arguments e.g. ' or " is better as default for strings. I wish it'd come with standard python distribution `python fmt`
Re: Black – Uncompromising Python code formatter
#5I use black because it is idempotent. Google's yapf lacks this property.
Edit: Previous discussion: https://news.ycombinator.com/item?id=17155048
Re: Black – Uncompromising Python code formatter
#6The way you can tell that black is good is that everyone mildly dislikes a few things about it, but they're usually different things.
That's usually a good clue that you've hit real middle-ground.
I blackify my projects once we hit 3 contributors.
Re: Black – Uncompromising Python code formatter
#7This is a case where I'm completely decided. Everybody should use an autoformatter. The minimal benefit you get from custom formatting is completely outweighed by the uniformity, the consistency and readability of autoformatted code.
Re: Black – Uncompromising Python code formatter
#8pre-commit with black and flake8 makes for a pretty low overhead setup to have a pretty consistent codebase
Re: Black – Uncompromising Python code formatter
#9We have been using this for almost 7-8 months and even though I don't personally like the style of it very much, it has helped keep everything consistent. You can set it up as a pre-commit hook to automatically format the code too
Re: Black – Uncompromising Python code formatter
#10How do you enforce the use of a formatter in a project -- pre-commit hook? pre-receive hook? both? And is there a convention to put a specific dotfile at the project root to hint at your IDE/editor that it should use a certain tool for automatic formatting?