From 254ad75c22e8964faf1b741dcf7a9e4e8ee37bed Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Mon, 22 Feb 2016 09:05:45 -0500 Subject: [PATCH] Gramatical and other improvements given by thefourtheye. Closes #26408 --- pep-0008.txt | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/pep-0008.txt b/pep-0008.txt index 2f4fb2d4c..ca9cf7dbd 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -42,10 +42,10 @@ spectrum of Python code. As PEP 20 says, "Readability counts". A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. -Consistency within one module or function is most important. +Consistency within one module or function is the most important. -But most importantly: know when to be inconsistent -- sometimes the -style guide just doesn't apply. When in doubt, use your best +However, know when to be inconsistent -- sometimes style guide +recommendations just aren't applicable. When in doubt, use your best judgment. Look at other examples and decide what looks best. And don't hesitate to ask! @@ -79,9 +79,9 @@ Use 4 spaces per indentation level. Continuation lines should align wrapped elements either vertically using Python's implicit line joining inside parentheses, brackets and braces, or using a *hanging indent* [#fn-hi]_. When using a hanging -indent the following considerations should be applied; there should be -no arguments on the first line and further indentation should be used -to clearly distinguish itself as a continuation line. +indent the following should be considered; there should be no +arguments on the first line and further indentation should be used to +clearly distinguish itself as a continuation line. Yes:: @@ -1231,8 +1231,8 @@ Programming Recommendations Yes: if not seq: if seq: - No: if len(seq) - if not len(seq) + No: if len(seq): + if not len(seq): - Don't write string literals that rely on significant trailing whitespace. Such trailing whitespace is visually indistinguishable @@ -1286,7 +1286,7 @@ annotations are changing. PEP 484 recommends the use of stub files: .pyi files that are read by the type checker in preference of the corresponding .py files. Stub files can be distributed with a library, or separately (with - the library author's permission) through the typeshed repo [5]_. + the library author's permission) through the typeshed repo [4]_. - For code that needs to be backwards compatible, function annotations can be added in the form of comments. Basically, this Python 3 annotation:: @@ -1302,7 +1302,7 @@ annotations are changing. """Embezzle funds from account using fake receipts.""" - The mypy type checker [6]_ currently supports this syntax, and other + The mypy type checker [5]_ currently supports this syntax, and other type checkers are encouraged to adopt it. @@ -1326,13 +1326,10 @@ References .. [3] http://www.wikipedia.com/wiki/CamelCase -.. [4] PEP 8 modernisation, July 2013 - http://bugs.python.org/issue18472 - -.. [5] Typeshed repo +.. [4] Typeshed repo https://github.com/python/typeshed -.. [6] mypy type checker +.. [5] mypy type checker http://mypy-lang.org https://github.com/JukkaL/mypy