Python "if" evaluates both hand sides of "and"?
<p>Can anybody tell me why the following fails:</p>

<pre><code>teststr = "foo"
if not teststr.isdigit() and int(teststr) != 1:
   pass
</code></pre>

<p>with:</p>

<pre><code>ValueError: invalid literal for int() with base 10: 'foo'
</code></pre>

<p>In C if the first part in an <code>&amp;&amp;</code> test fails the right hand side is not evaluated anymore. Is this different in Python? </p>

<p>EDIT: I am being stupid. The <code>and</code> should be an <code>or</code> of course.....</p>
