擅长:python、mysql、java
<p>你的<code>x is None != y is None</code>是“<a href="https://docs.python.org/3/reference/expressions.html#comparisons" rel="nofollow noreferrer">chained comparisons</a>”。更典型的例子是<code>3 < x < 9</code>。意思与<code>(3 < x) and (x < 9)</code>相同。在你的例子中,使用操作符<code>is</code>和<code>!=</code>,这是:</p>
<pre><code>(x is None) and (None != y) and (y is None)
</code></pre>
<p>这是假的,因为<code>y is None</code>是假的。你知道吗</p>