title: How to specify list and tuple type in cython
body: <p>I have a simple function which transforms a list of a bonds between nodes into a list of neighboring nodes. The input is "list of tuples of integers" and the output "list of lists of integers," e.g.</p>
  
  <pre><code> input:  bonds     = [(1,2), (1,4)]
   output: neighbors = [[],[2,4],[1],[],[1]]
  </code></pre>
  
  <p>Is there anything I can do to specify these types more precisely so that Cython can optimize it better? The function looks like this:</p>
  
  <pre><code>def bonds2neighs( list bonds, int natom ):
      cdef:
          int  ii
          list neighbors = [ [] for ii in xrange(natom) ]
          int i,j
      for i,j in bonds: 
          neighbors[i].append(j)
          neighbors[j].append(i)
      return neighbors
  </code></pre>