A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20150320/8ed96573/attachment.html below:

<div dir="ltr">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.<div><br></div><div>Best,</div><div><br></div><div>Neil</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 20, 2015 at 10:35 PM, Brian Curtin <span dir="ltr"><<a href="mailto:brian@python.org" target="_blank">brian@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Mar 20, 2015 at 7:54 PM, Neil Girdhar <<a href="mailto:mistersheik@gmail.com">mistersheik@gmail.com</a>> wrote:<br>
> If ever someone wants to clean up the repository to conform to PEP 7, I<br>
> wrote a program that catches a couple hundred PEP 7 violations in ./Python<br>
> alone (1400 in the whole codebase):<br>
><br>
> import os<br>
> import re<br>
><br>
> def grep(path, regex):<br>
>  Â  Â reg_obj = re.compile(regex, re.M)<br>
>  Â  Â res = []<br>
>  Â  Â for root, dirs, fnames in os.walk(path):<br>
>  Â  Â  Â  Â for fname in fnames:<br>
>  Â  Â  Â  Â  Â  Â if fname.endswith('.c'):<br>
>  Â  Â  Â  Â  Â  Â  Â  Â path = os.path.join(root, fname)<br>
>  Â  Â  Â  Â  Â  Â  Â  Â with open(path) as f:<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â data = f.read()<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â for m in reg_obj.finditer(data):<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â line_number = sum(c == '\n'<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â for c in data[:m.start()]) + 1<br>
>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â res.append("{}: {}".format(path, line_number))<br>
>  Â  Â return res<br>
><br>
> for pattern in [<br>
>  Â  Â  Â  Â r'^\s*\|\|',<br>
>  Â  Â  Â  Â r'^\s*\&\&',<br>
>  Â  Â  Â  Â r'} else {',<br>
>  Â  Â  Â  Â r'\<return\s*\(',<br>
> ]:<br>
>  Â  Â print("Searching for", pattern)<br>
>  Â  Â print("\n".join(grep('.', pattern)))<br>
><br>
> In my experience, it was hard to write PEP 7 conforming code when the<br>
> surrounding code is inconsistent.<br>
<br>
</div></div>You can usually change surrounding code within reason if you want to<br>
add conforming code of your own, but there's little value and high<br>
risk in any mass change just to apply the style guidelines.<br>
</blockquote></div><br></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4