title: Is there a max length to a python conditional (if) statement?
body: <p>I generate a conditional statement using python's (2.7) <code>eval()</code> function like so:</p>
  
  <pre><code>my_list = ['2 &gt; 1','3 &gt; 2','4 &gt; 3']
  
  if eval('(' + ') or ('.join(my_list) + ')'):
      print 'yes'
  else:
      print 'no'
  </code></pre>
  
  <p>In my case, the list is generated by code, my_list comes from a parameter file, and the list is joined with 'or' statements in the conditional expression. The code above prints 'yes'.</p>
  
  <p>It works fine for small lists, but at a certain number of characters in the <code>eval()</code> statement and I get a string error.</p>
  
  <p>Some searching finds these threads that point to a bug:</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/q/11635211/2327328">Why is there a length limit to python&#39;s eval?</a></p></li>
  <li><p><a href="https://stackoverflow.com/q/5177432/2327328">segmentation fault in pi calculation (python)</a></p></li>
  </ul>
  
  <p>But their max eval() size is much larger than what I found. In my case, I find between 1744 and 1803 characters does the issue begin. I tried this code and it does crash between the two statements</p>
  
  <pre><code>&gt;&gt;&gt; eval("1.0*"*10000+"1.0")
  1.0
  &gt;&gt;&gt; eval("1.0*"*100000+"1.0")
  # segfault here
  </code></pre>
  
  <p>So, that brings me back to think that it is not eval(), but actually some max on the <code>if</code> statement.</p>
  
  <p><strong>What's another way to conditionally apply the rules in the list that doesn't involve long strings and the eval() function?</strong></p>
  
  <p>Interestingly, I made my_list much bigger:</p>
  
  <pre><code>my_list = ['2 &gt; 1']*1000000
  </code></pre>
  
  <p>and the code works fine...</p>