title: Evaluate None object in boost python
body: <p>I am passing a list of (mostly) floats to a module in boost python, some elements are None objects. In the C++ code I am extracting the floats like so:</p>
  
  <pre><code>for(i=0;i&lt;boost::python::len(list) - window_len + 1;i++) {
    double value = boost::python::extract&lt;double&gt;(list[i]);
  }
  </code></pre>
  
  <p>This is obviously problematic when list[i] points to a python None object. As such I wrote something like this:</p>
  
  <pre><code>for(i=0;i&lt;boost::python::len(list) - window_len + 1;i++) {
    if(list[i] == NULL) continue;
    double value = boost::python::extract&lt;double&gt;(list[i]);
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>for(i=0;i&lt;boost::python::len(list) - window_len + 1;i++) {
    if(list[i] == boost::python::api::object()) continue;
    double value = boost::python::extract&lt;double&gt;(list[i]);
  }
  </code></pre>
  
  <p>because apparently boost::python::api::object() evaluates to None. However, neither of these work. How can I check that list[i] in a python None object?</p>