I need to check if an object has an attribute from c++. I'm using this low-level approach: (r is an object): if (PyObject_HasAttrString (r.ptr(), "__len__")) { Nothing wrong with that, but is there something in the boost::python api to handle this?