title: Python: Conditional OR
body: <p>I have the following <code>while</code> loop:</p>
  
  <pre><code>accuracy = 0.0001    #  Or whatever
  loop_limit = True
  limit = 100
  #  Main loop:
  while abs(P - P_old).max() &gt; accuracy or (if loop_limit: count &gt; limit):  
  </code></pre>
  
  <p>Needless to say it doesn't work. What I want, is for the <code>or</code> statement to be checked only when <code>loop_limit = True</code>.</p>
  
  <p>I could put an <code>if</code> statement into the <code>while</code> loop which resets the count variable on every pass of the loop only if <code>loop_limit = True</code>, but that would have to check loop_limit on every pass of the <code>while</code> loop and i want to avoid that. (The loop is going to be running millions of times over and every time saver helps). I have a feeling there is a neat way of doing this.</p>
  
  <p>Edit:</p>
  
  <p>Note that (P - P_old) is a numpy array, hence the <code>.max()</code> I forgot to mention that and i don't want to remove it now since it has been referenced in an answer already.</p>