Proposal: format GDB Python files with black

Paul Koning paulkoning@comcast.net
Mon Apr 26 17:34:06 GMT 2021



> On Apr 26, 2021, at 11:55 AM, Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> wrote:
> 
> Hi all,
> 
> A few people I talked to about this and I have good experience with the
> tool black to auto-format Python code.  It is simple to use, fast and
> reliable (if it detects that it changed the meaning of the program by
> mistake, internal-errors out).  I don't think I need to spell out the
> advantage of using such a tool, but just in case: it removes all the
> overhead of thinking about formatting when writing or reviewing code.

In the case of Python, formatting is a core part of writing the code.  Apart from that, I don't see much need for this, what with Emacs editing mechanisms.

I looked at the sample you mentioned.  It's reasonable enough except for the bizarre way of formatting a long parenthesized condition in an if statement (near the start of FrameDecorator.py).  So while I can't see any reason to use this, it seems ok as a tool that others might use if they like to do so.

I would object to having this mandatory.

	paul




More information about the Gdb-patches mailing list