title: How to write a python script using declarative logic
body: <p>This is a complex question (at least for me) and I hope there's a book/website/blog someone can point me to to help give me a start.  Can someone tell me where I can find info to write a script in python where it reads a bunch of logic statements and applies that logic to a bunch of data being read in?  I can do this in a non-declarative manner but that means any time there's a new logic statement, I'd need to write new code to handle it.  If I can write some generic script that can interpret the logic statement, then I won't need to keep writing code to keep up with new logic statements.</p>
  
  <p>What I'm trying to do is I have 3 files my script will read.  Two files of equal length contain values for two metrics.  The third is a file with logic statements.  I want the script to read in the logic statements and apply those statements to the numbers and write messages if it fulfills those statements.</p>
  
  <p>For example, file 1 will contain:</p>
  
  <pre><code>1
  2
  3
  4
  5
  6
  </code></pre>
  
  <p>file 2 will contain:</p>
  
  <pre><code>2
  4
  6
  8
  10
  3
  </code></pre>
  
  <p>file 3, will contain:</p>
  
  <pre><code>m1 &gt;=3 &amp;&amp; (m1 + m2) &gt;= 11
  </code></pre>
  
  <p>If I run my script, I want it to output something that says</p>
  
  <pre><code>m1 = 4 and m2 = 8 fulfills condition m1 &gt;= 3 &amp;&amp; (m1 + m2) &gt;= 11
  m1 = 5 and m2 = 10 fulfills condition m1 &gt;= 3 &amp;&amp; (m1 + m2) &gt;= 11
  </code></pre>