[Python-checkins] peps: Incorporate PEP 8 text from Ian Lee to clarify annotation policy
chris.angelico
python-checkins at python.org
Sat Jan 3 03:27:39 CET 2015
https://hg.python.org/peps/rev/7eb1ddc0291c
changeset: 5654:7eb1ddc0291c
user: Chris Angelico <rosuav at gmail.com>
date: Sat Jan 03 13:22:31 2015 +1100
summary:
Incorporate PEP 8 text from Ian Lee to clarify annotation policy
files:
pep-0008.txt | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/pep-0008.txt b/pep-0008.txt
--- a/pep-0008.txt
+++ b/pep-0008.txt
@@ -514,6 +514,19 @@
def complex(real, imag = 0.0):
return magic(r = real, i = imag)
+- Do use spaces around the ``=`` sign of an annotated function definition.
+ Additionally, use a single space after the ``:``, as well as a single space
+ on either side of the ``->`` sign representing an annotated return value.
+
+ Yes: def munge(input: AnyStr):
+ Yes: def munge(sep: AnyStr = None):
+ Yes: def munge() -> AnyStr:
+ Yes: def munge(input: AnyStr, sep: AnyStr = None, limit=1000):
+
+ No: def munge(input: AnyStr=None):
+ No: def munge(input:AnyStr):
+ No: def munge(input: AnyStr)->PosInt:
+
- Compound statements (multiple statements on the same line) are
generally discouraged.
--
Repository URL: https://hg.python.org/peps
More information about the Python-checkins
mailing list