[C++-sig] Re: C++ classes intended for use with Python

David Abrahams dave at boost-consulting.com
Tue Aug 10 17:35:52 CEST 2004


Itamar Shtull-Trauring <itamar at itamarst.org> writes:

> Currently, if I want to have virtual methods overridable in Python I
> need to go through the whole wrapper class song and dance. Thing is, I
> am creating classes whose only goal is to integrate with Python. I'm not
> wrapping a C++ library, I'm writing a Python/C++ library. Is there any
> way I can have classes automatically get an appropriate PyObject*  self
> argument when instantiated? Obviously they'd be only used by subclassing
> them in Python.

Use the new idiom of deriving X from wrapper<X> (use MI if
neccessary).  See this thread for details:

http://news.gmane.org/find-root.php?message_id=%3cusmbedb9y.fsf%40boost%2dconsulting.com%3e



HTH,

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Cplusplus-sig mailing list