title: Pass list of lists as argument to Rust from Python using PyO3
body: <p>I'm trying to pass a list of lists from Python to Rust using Py03. The function I'm trying to pass it to has this signature:</p>
  <pre class="lang-rust prettyprint-override"><code>pub fn k_nearest_neighbours(k: usize, x: &amp;[[f32; 2]], y: &amp;[[f32; 3]]) -&gt; Vec&lt;Option&lt;f32&gt;&gt; 
  </code></pre>
  <p>I'm writing bindings for a pre-existing lib, therefore I cannot alter the original code. My current way of doing things is this:</p>
  <pre class="lang-rust prettyprint-override"><code>// This is example code == DOES NOT WORK
  #[pyfunction] // make a new function within a new library with pyfunction macro
  fn k_nearest_neighbours(k: usize, x: Vec&lt;Vec&lt;f32&gt;&gt;, y: Vec&lt;f32&gt;) -&gt; Vec&lt;Option&lt;f32&gt;&gt; {
      // reformat input where necessary
      let x_slice = x.as_slice();
      // return original lib's function return
      classification::k_nearest_neighbours(k, x_slice, y)
  }
  </code></pre>
  <p>The <code>x.as_slice()</code> function <em>almost</em> does what I need it to, it gives me a slice of vectors <code>&amp;[Vec&lt;f32&gt;]</code>, instead of a slice of slices <code>&amp;[[f32; 3]]</code>.</p>
  <p>I want to be able to run this Python code:</p>
  <pre class="lang-py prettyprint-override"><code>from rust_code import k_nearest_neighbours as knn  # this is the Rust function compiled with PyO3
  
  X = [[0.0, 1.0], [2.0, 3.0], [4.0, 5.0], [0.06, 7.0]]
  train = [
          [0.0, 0.0, 0.0],
          [0.5, 0.5, 0.0],
          [3.0, 3.0, 1.0],
          [4.0, 3.0, 1.0],
      ]
  
  k = 2
  y_true = [0, 1, 1, 1]
  y_test = knn(k, X, train)
  assert(y_true == y_test)
  
  </code></pre>