<div dir="ltr">Just few more points (not in any particular order):<div><br></div><div>- If black is used, all open pull requests, branches etc will need to be rebased. My guess is that it will often be easier to just re-implement instead of solving the conflicts.</div><div>- Unless black is used on releasebranches too, backporting will not be trivial and/or automated.</div><div>- black uses 88 chars as the default line length. For legacy python this is usually enough, but for newer code using type annotations you often want to bump that up to 100 or even 120 chars</div><div>- black formats functions/methods with a lot of arguments in a specific way that may not be to everyone's liking. E.g.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">def foo(aaaaaaaaaaaa, bbbbbbbbbbbb, cccccccccccccccc, ddddddddddddddddddd):<br></font><font face="courier new, monospace">    pass</font></blockquote><div><br></div><div>becomes:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">def foo(<br>    aaaaaaaaaaaa,<br>    bbbbbbbbbbbb,<br>    cccccccccccccccc,<br>    ddddddddddddddddddd,<br>):<br>    pass</font></blockquote><div> </div><div>bumping up the line length, somewhat's mitigates this.</div><div><br></div><div>- black is an automated tool. Optimal results are usually achieved by manually adjusting the code and/or writing the code in a way that is compatible with black (i.e. black will not change it). a typical example - and there are more - are double list comprehensions (which IMHV should usually be avoided but that's not really relevant here). E.g:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:"courier new",monospace">words =</span><span style="font-family:"courier new",monospace"> </span><font face="courier new, monospace">[word.upper() for sentence in paragraph for word in sentence]</font><br></blockquote><div><br></div><div>becomes:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">words = [<br>    word.upper()<br>    for sentence in paragraph<br>    for word in sentence<br>]</font></blockquote><div><br></div><div>Re-rewriting this as a nested loop is one less line of code, is more readable because it doesn't change the flow of execution, is more expendable and is obviously more familiar to those who don't know python that well:<br><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">words = []<br>for sentence in paragraph:<br>    for word in sentence:<br>        words.append(word.upper()) </font></blockquote><div> </div><div>For the record, this particular case could be re-written using itertools.chain</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">from itertools import chain</font> </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace"><br></font><span style="font-family:"courier new",monospace">words = </span><font face="courier new, monospace">[word.upper() for word in chain(*paragraph)]</font></blockquote><div><br></div><div>- black doesn't play too well with inline comments. E.g. </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">a = [<br>    "a",<br>    "b",  # noqa<br>    "c", <br>]</font></blockquote><div><br></div><div>will be transformed to:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace">a = ["a", "b", "c"]  # noqa</font></blockquote><div><br></div><div>This means that the noqa comment will be applied to all the arguments instead of "b" only. </div><div><br></div><div>- Probably not a huge issue for GRASS, but black does not preserve indentation of comments. So E.g this will become:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace"># class A(object):<br>    # def __init__(self):<br>        # self.a = 1<br>        # self.b = 2 </font></blockquote><div><br></div><div> will become</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font face="courier new, monospace"># class A(object):<br># def __init__(</font><span style="font-family:"courier new",monospace">self</span><font face="courier new, monospace">):<br># self.a = 1<br># self.b = 2 </font></blockquote><div><br></div><div>If you want to preserve the indentation you would need to comment out using this:</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-family:"courier new",monospace"># class A(object):<br></span><span style="font-family:"courier new",monospace">#    def __init__(</span><span style="font-family:"courier new",monospace">self</span><span style="font-family:"courier new",monospace">):<br></span><span style="font-family:"courier new",monospace">#        self.a = 1<br></span><span style="font-family:"courier new",monospace">#        self.b = 2 </span></blockquote><div> </div><div>all the best,</div><div>P.</div></div>