<p>我一直认为<code>if not x is None</code>版本更清晰,但是Google的<a href="https://google.github.io/styleguide/pyguide.html?showone=True/False_evaluations#True/False_evaluations" rel="noreferrer">style guide</a>和<a href="https://www.python.org/dev/peps/pep-0008/#programming-recommendations" rel="noreferrer">PEP-8</a>都使用<code>if x is not None</code>。有没有小的表现差异(我想没有),有没有一个真的不适合(使另一个明显的赢家为我的公约)?*</p>
<p>*我指的是任何单体,而不仅仅是<code>None</code>。</p>
<blockquote>
<p>...to compare singletons like
None. Use is or is not.</p>
</blockquote>