Incorporate PEP 8 text from Ian Lee to clarify annotation policy

This commit is contained in:
Chris Angelico 2015-01-03 13:22:31 +11:00
parent 48e4630fce
commit 44c193d765
1 changed files with 13 additions and 0 deletions

View File

@ -514,6 +514,19 @@ Other Recommendations
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.