diff --git a/pep-0008.txt b/pep-0008.txt index 21cc99be1..4d7bc9c1f 100644 --- a/pep-0008.txt +++ b/pep-0008.txt @@ -552,19 +552,6 @@ Other Recommendations hypot2 = x * x + y * y c = (a + b) * (a - b) -- Don't use spaces around the ``=`` sign when used to indicate a - keyword argument or a default parameter value. - - Yes:: - - def complex(real, imag=0.0): - return magic(r=real, i=imag) - - No:: - - def complex(real, imag = 0.0): - return magic(r = real, i = imag) - - Function annotations should use the normal rules for colons and always have spaces around the ``->`` arrow if present. (See `Function Annotations`_ below for more about function annotations.) @@ -579,9 +566,23 @@ Other Recommendations def munge(input:AnyStr): ... def munge()->PosInt: ... -- When combining an argument annotation with a default value, use - spaces around the ``=`` sign (but only for those arguments that have - both an annotation and a default). +- Don't use spaces around the ``=`` sign when used to indicate a + keyword argument, or when used to indicate a default value for an + *unannotated* function parameter. + + Yes:: + + def complex(real, imag=0.0): + return magic(r=real, i=imag) + + No:: + + def complex(real, imag = 0.0): + return magic(r = real, i = imag) + + + When combining an argument annotation with a default value, however, do use + spaces around the ``=`` sign: Yes::