I believe you're reading it wrong. Try not to think of greeting
as a noun so much as a verb ("I am greeting" instead of "This is a greeting").
You can see the clue in the preamble to PEP8:
One of Guido's key insights is that code is read much more often than it is written. The guidelines provided here are intended to improve the readability of code.
To that end, code should resemble the written or spoken word as much as possible. You don't say "If I am annoying you is true, let me know"
in real life, you just say "If I am annoying you, let me know"
.
That's one reason why you tend to see boolean variables like isOpen
and hasBeenProcessed
a lot since they aid in readability of the code.
You should never do something like:
if (isOpen == True)
or:
if (customerDead == False)
simply because you already have a boolean value in the variable name. All the equality is giving you is another boolean value and, invoking reduction ad absurdum, where would you stop?
if (isComplete == True) ...
if ((isComplete == True) == True) ...
if (((isComplete == True) == True) == True) ...
if ((((isComplete == True) == True) == True) == True)...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…