[Python-Dev] pep 7

Guido van Rossum guido at python.org
Sat Mar 21 04:57:02 CET 2015


Neil, you have no idea. Please back off.

On Fri, Mar 20, 2015 at 8:02 PM, Neil Girdhar <mistersheik at gmail.com> wrote:

> The code reviews I got asked me to revert PEP 7 changes.  I can understand
> that, but then logically someone should go ahead and clean up the code.
> It's not "high risk" if you just check for whitespace equivalence of the
> source code and binary equivalence of the compiled code.  The value is for
> people who are new to the codebase.
>
> Best,
>
> Neil
>
> On Fri, Mar 20, 2015 at 10:35 PM, Brian Curtin <brian at python.org> wrote:
>
>> On Fri, Mar 20, 2015 at 7:54 PM, Neil Girdhar <mistersheik at gmail.com>
>> wrote:
>> > If ever someone wants to clean up the repository to conform to PEP 7, I
>> > wrote a program that catches a couple hundred PEP 7 violations in
>> ./Python
>> > alone (1400 in the whole codebase):
>> >
>> > import os
>> > import re
>> >
>> > def grep(path, regex):
>> >     reg_obj = re.compile(regex, re.M)
>> >     res = []
>> >     for root, dirs, fnames in os.walk(path):
>> >         for fname in fnames:
>> >             if fname.endswith('.c'):
>> >                 path = os.path.join(root, fname)
>> >                 with open(path) as f:
>> >                     data = f.read()
>> >                     for m in reg_obj.finditer(data):
>> >                         line_number = sum(c == '\n'
>> >                                           for c in data[:m.start()]) + 1
>> >                         res.append("{}: {}".format(path, line_number))
>> >     return res
>> >
>> > for pattern in [
>> >         r'^\s*\|\|',
>> >         r'^\s*\&\&',
>> >         r'} else {',
>> >         r'\<return\s*\(',
>> > ]:
>> >     print("Searching for", pattern)
>> >     print("\n".join(grep('.', pattern)))
>> >
>> > In my experience, it was hard to write PEP 7 conforming code when the
>> > surrounding code is inconsistent.
>>
>> You can usually change surrounding code within reason if you want to
>> add conforming code of your own, but there's little value and high
>> risk in any mass change just to apply the style guidelines.
>>
>
>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>
>


-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150320/262df9bb/attachment.html>


More information about the Python-Dev mailing list