[Python-ideas] gofmt for Python: standardized styling as a language feature

Donald Stufft donald at stufft.io
Fri Mar 20 06:12:11 CET 2015


> On Mar 20, 2015, at 1:02 AM, Stephen J. Turnbull <stephen at xemacs.org> wrote:
> 
> Donald Stufft writes:
>>>>>> Guido van Rossum writes:
> 
>>> I have always been skeptical of automatic style checkers. They
>>> encourage a nit-pickish attitude that makes the development
>>> process less effective, by encouraging critique of superficial
>>> style elements rather than of the code's structure and
>>> meaning. In contrast, the intention of PEP 8 was to make code
>>> more readable so that its structure and meaning are more easily
>>> understood.
>> 
>> My experience is actually the exact opposite.
> 
> This is one of those things where people differ.  I'm happy to follow
> Guido on this, although personally I've been able to adapt to
> mechanical rules where required.
> 
>> In my experience projects without mechnical enforcement ends up
>> with massively inconsistent style all throughout the code base. The
>> Python stdlib is a good example of this. Contrast this to projects
>> like github.com/pyca/cryptography
>> <http://github.com/pyca/cryptography> where there is an automated
>> mechanical enforcement of style and it’s got some bare minimum of
>> consistency throughout the entire code base.
> 
> Which proves what?  That enforcing minimal style rules (and I think we
> all agree that there's plenty of good and bad style that machines
> can't yet reliably distinguish) results in a code base that follows
> minimal style rules?
> 

Sure, just like tests can’t guarantee that a code base works in every
situation but that it works in some minimal set of tests (where minimal
is whatever tests were written).

Humans are inconsistent and emotional, people are more likely to nitpick
a patch that they don’t particularly like in an unconscious attempt to
discourage the contribution. They are also far more likely to let things
slip when it’s a contribution from someone they like or even from themselves.

Working on the Python stdlib is somewhat frustrating to me in this regard
because the code in the stdlib is often times wildly inconsistent even within
the same module.

Maybe having inconsistent style which is inconsistently applied doesn’t
bother you, that’s fine. I don’t particularly mind if the stdlib gains an
automated style checker or formatter because I’m happy using third party
modules. I was merely offering my experience that *anything* which relies
on a human to verify it is, without exception, going to be verified unevenly
and that using a human to verify it invites people to attempt to argue
against it more often than when a machine does it.

---
Donald Stufft
PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150320/84bf3d6f/attachment-0001.sig>


More information about the Python-ideas mailing list