[Python-Dev] PEP 7 clarification request: braces

Stephen J. Turnbull stephen at xemacs.org
Wed Jan 4 05:10:37 CET 2012


Benjamin Peterson writes:
 > Ethan Furman <ethan <at> stoneleaf.us> writes:
 > > 
 > > Readability also includes more than just the source code; as has already 
 > > been stated:

[diffs elided]

 > > I find the diff version that already had braces in place much more readable.
 > 
 > There are much larger problems facing diff readibility. On your basis, we might
 > as well decree that code should never be arranged or reindented.

That's a reasonable approach sometimes used, but it would be hard in
Python.  Specifically, I often produce two patches when substantial
rearrangement is involved.  The first isolates the actual changes, the
second does the reformatting.

In Python, the first patch might be syntactically erroneous, which
would be both annoying for automatic testing and less readable.  A
Python-friendly alternative is to provide both a machine-appliable
diff and a diff ignoring whitespace changes.  This could be a toggle
in web interfaces to the VCS.  I've also sometimes found doing word
diffs to be useful.

Most developers resist such procedures passionately, though.  *shrug*



More information about the Python-Dev mailing list