[C++-sig] Boost.Python v2: beginning of generalized object support

David Abrahams david.abrahams at rcn.com
Sun Jun 16 22:51:24 CEST 2002


I've just checked in the foundations for generalized object support
(boost/python/object.hpp). Details:

borrow() has been renamed to borrowed() as per user suggestions.
handle<> now converts automatically to/from python in argument lists and
return values
object converts automatically to/from python also

object attribute access is available through the "_" member function:

C++                    Python

x._("foo") = 1;        x.foo = 1
y = x._("foo");        y = x.foo

getitem/setitem support is implemented via operator[] in the expected ways.

x["foo"] = 1;          x['foo'] = 1
y = x[z];              y = x[z];

callable objects can be called from C++, just as from Python:

z = x(1, y)            z = x(1, y)

operators are coming, as are the python built-in functions such as
isinstance().

Regards,
Dave

+---------------------------------------------------------------+
                  David Abrahams
      C++ Booster (http://www.boost.org)               O__  ==
      Pythonista (http://www.python.org)              c/ /'_ ==
  resume: http://users.rcn.com/abrahams/resume.html  (*) \(*) ==
          email: david.abrahams at rcn.com
+---------------------------------------------------------------+






More information about the Cplusplus-sig mailing list