[C++-sig] [boost][python2.5] "with" support

Colin Grealy cgrealy at mailcan.com
Wed Sep 27 07:08:10 CEST 2006


On Tue, 26 Sep 2006 16:44:50 -0700, "Alex Mohr" <amohr at pixar.com> said:
> What sort of support are you looking for?  You can certainly def() those 
> methods on your wrapped classes easily with no changes to bpl.  Are you 
> thinking that one might want some sort of mapping from C++ 
> constructors/destructors to these methods?  I don't see a way that that 
> would work off the top of my head.
> 
> Alex

True, but to define the __exit__ method you need to write a C++ method
with the following signature

void func(boost::python::object exc_type,
          boost::python::object exc_val,
          boost::python::object exc_tb)

Most of the C++ objects I wrap are not python aware. I'd like some way
of wrapping a call to a simple method (e.g. void cleanup()). I suppose
I'm looking for a generic way to discard arguements from python.




More information about the Cplusplus-sig mailing list