[C++-sig] howto check for an attr from c++?

Neal Becker ndbecker2 at gmail.com
Fri Apr 13 15:20:28 CEST 2007

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?

More information about the Cplusplus-sig mailing list