[C++-sig] Re: iterate through boot::python::list
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Wed Mar 12 18:01:54 CET 2003
--- harold fellermann <harold at imb-jena.de> wrote:
> The code looks like the following:
>
> class X {
> // ...
> };
>
> class Y {
> public:
> void insert(X &);
> boost::python::list xlist;
> };
>
> void Y::insert(X &x) {
> // do some other things
> xlist.insert(0,x)
> }
>
> int main() {
> X x; Y y;
> y.insert(x);
> }
>
> Unfortunately this little snippet crashes:
Of course. You are not initializing the Python interpreter.
Are you aware of the difference between "extending" and "embedding"?
There is an "embedding" example in the Boost 1.30.0 release candidate that you
might want to look at (boost/libs/python/test/embedding.cpp). Most everything
else in that directory are "extending" examples.
Ralf
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com
More information about the Cplusplus-sig
mailing list