[Python-Dev] Suggested addition to PEP 8 for context managers
Floris Bruynooghe
flub at devork.be
Mon Apr 23 12:15:31 CEST 2012
[resent since I accidentally dropped the list]
Hi,
On 19 April 2012 15:55, Barry Warsaw <barry at python.org> wrote:
> I'll make this change to the PEP. I'm not entirely sure the Yes/No examples
> are great illustrations of this change in wording though. Here's the diff so
> far (uncommitted):
>
> diff -r 34076bfed420 pep-0008.txt
> --- a/pep-0008.txt Thu Apr 19 10:32:50 2012 +0200
> +++ b/pep-0008.txt Thu Apr 19 10:53:15 2012 -0400
> @@ -305,7 +305,11 @@
> ``>=``, ``in``, ``not in``, ``is``, ``is not``), Booleans (``and``,
> ``or``, ``not``).
>
> -- Use spaces around arithmetic operators:
> +- If operators with different priorities are used, consider adding
> + whitespace around the operators with the lowest priority(ies). This
> + is very much to taste; however, never use more than one space, and
> + always have the same amount of whitespace on both sides of a binary
> + operator.
While the text is certainly an improvement it seems to me that right
now some of the examples following under the "No:" should be moved to
"Yes:"
"""
No:
i=i+1
submitted +=1
x = x*2 - 1
hypot2 = x*x + y*y
c = (a+b) * (a-b)
"""
In particular "x = x*2 -1" and "hypot2 = x*x + y*y" sound like they
should be under "Yes".
Regards,
Floris
--
Debian GNU/Linux -- The Power of Freedom
www.debian.org | www.gnu.org | www.kernel.org
More information about the Python-Dev
mailing list