title: Applying multiple filters to list of tuples
body: <p>I am looking for an efficient, pythonic way to apply multiple filters to a list of tuples. </p>
  
  <p>As an example, assume filters like this:</p>
  
  <pre><code>def f1(t): return t[3]&lt;10
  def f2(t): return t[0]!=1
  def f3(t): return t[1] in ("lisa","eric")
  def f4(t): return t[3]&gt;2
  </code></pre>
  
  <p>And n-tuples (i.e. db-records) like this:</p>
  
  <pre><code>tuples=[
  (0,'tom','...',8),
  (1,'john','...',17),
  (2,'lisa','...',1),
  (3,'eric','...',18)
  ]
  </code></pre>
  
  <p>The following works:</p>
  
  <pre><code>def nFilter(filters,tuples):
      if filters and tuples:
          return nFilter(filters,filter(filters.pop(),tuples))
      else: return tuples
  </code></pre>
  
  <p>With results like:</p>
  
  <pre><code>&gt;&gt;&gt; nFilter([f1,f2,f3],tuples)
  [(2, 'lisa', '...', 1)]
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt;&gt;&gt; nFilter([f1,f2,f3,f4],tuples)
  []
  </code></pre>
  
  <p>But I'm wondering if there is a more direct way; what I had in mind is something like function composition (i.e <code>f1(f2(...fn(tuples)...))</code>), for an arbitrary list of functions. There are references to a <a href="http://docs.python.org/release/3.1.5/howto/functional.html#the-functional-module" rel="noreferrer">functional library</a> containing a <code>compose</code> function in the docs, but the links are all dead. </p>
  
  <p>Also, since I'm planning on using this on fairly large data sets, and possibly with a large number of filters in a production web service, it must be efficient, and I can't really say if this solution is.</p>
  
  <p>Any suggestions or improvements are welcome.</p>