title: python - creating an sql condition object with overloading operators
body: <p>I am writing a wrapper for SQL Conditions ( so that I can use them in my where statement that I also have a wrapper for ).</p>
  
  <p>Idea is that all of them would be valid :</p>
  
  <pre><code>&gt;&gt; condition_a = Condition("x","=","5")
  &gt;&gt; condition_b = Condition("y","&gt;","6")
  &gt;&gt; c = condition_a &amp; condition_b
  which should give me " x = 5 AND y &gt; 6 "
  </code></pre>
  
  <p>that is fine so far - I can do so by overloading <strong>and</strong>, and <strong>or</strong>.</p>
  
  <p>I don't know <strong><em>what I should overload</em></strong> to have <code>(</code> working like this ? </p>
  
  <pre><code>&gt;&gt; condition_a = Condition("x","=","5")
  &gt;&gt; condition_b = Condition("y","&gt;","6")
  &gt;&gt; condition_c = Condition("z","&gt;","7")
  &gt;&gt; d = condition_c &amp; ( condition_a |  condition_b )
  which should give me " z &gt; 7 AND ( x = 5 OR y &gt; 6 ) "
  </code></pre>
  
  <p>Sceleton for my condition class is :</p>
  
  <pre><code>class Condition( object ) :
      def __init__( self , args ) :
          ....
  
      def __and__( self , other ) :
        ...
  
      def __or__( self , other ) : 
         ...
  </code></pre>
  
  <p>How can i do that?</p>