Additional PEP 8 tweaks
- be explicit that project style guides take precedence - make a line splitting example consistent with other guidelines - clarify wording of the def-vs-lambda guideline
This commit is contained in:
parent
69ab45adcc
commit
ad0edb7348
12
pep-0008.txt
12
pep-0008.txt
|
@ -28,6 +28,10 @@ This style guide evolves over time as additional conventions are
|
||||||
identified and past conventions are rendered obsolete by changes in
|
identified and past conventions are rendered obsolete by changes in
|
||||||
the language itself.
|
the language itself.
|
||||||
|
|
||||||
|
Many projects incorporate this guide by reference into their own style
|
||||||
|
guides. In the event of any conflicts, the project-specific style guide
|
||||||
|
takes precedence.
|
||||||
|
|
||||||
|
|
||||||
A Foolish Consistency is the Hobgoblin of Little Minds
|
A Foolish Consistency is the Hobgoblin of Little Minds
|
||||||
======================================================
|
======================================================
|
||||||
|
@ -201,8 +205,8 @@ before it. Some examples::
|
||||||
def __init__(self, width, height,
|
def __init__(self, width, height,
|
||||||
color='black', emphasis=None, highlight=0):
|
color='black', emphasis=None, highlight=0):
|
||||||
if (width == 0 and height == 0 and
|
if (width == 0 and height == 0 and
|
||||||
color == 'red' and emphasis == 'strong' or
|
color == 'red' and emphasis == 'strong' or
|
||||||
highlight > 100):
|
highlight > 100):
|
||||||
raise ValueError("sorry, you lose")
|
raise ValueError("sorry, you lose")
|
||||||
if width == 0 and height == 0 and (color == 'red' or
|
if width == 0 and height == 0 and (color == 'red' or
|
||||||
emphasis is None):
|
emphasis is None):
|
||||||
|
@ -882,8 +886,8 @@ Programming Recommendations
|
||||||
operator. However, it is best to implement all six operations so
|
operator. However, it is best to implement all six operations so
|
||||||
that confusion doesn't arise in other contexts.
|
that confusion doesn't arise in other contexts.
|
||||||
|
|
||||||
- Always use a def statement instead of assigning a lambda expression
|
- Always use a def statement instead of an assignment statement that binds
|
||||||
to a name.
|
a lambda expression directly to a name.
|
||||||
|
|
||||||
Yes::
|
Yes::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue