Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-09-30 09:02:43


Xavier,

Sorry I didn't back to you earlier,

----- Original Message -----
From: "Xavier Defrang" <xavier_at_[hidden]>

> I looked around py_cpp and its documentation and this
> set of classes looks quite impressive : you did a great job!

Thanks <blush>

> As far as I've seen, you focused on extending Python with C++
> objects. But what about embedding python in C++ code. I've been
> thinking about a pystream which could be used as follow :

Well, there are always the standard approaches, e.g. PyEval_CallFunction(),
etc.

> void foo()
> {
> pystream s;
> s << "import sys" << endl;
> << "print 'Hello world from embedded Python'" << endl
> << "print 'This program runs on', sys.platform" << endl;
> }
>
> These are only my very early thoughts about that pystream concept.
> I'm too newbie to the Python embedding API to figure out all the
> possibities of such a class but I'm sure some Pythonholic persons
> in here will spot me some ideas...
>
> I've been already excited by the way I could use std::copy() to
> execute programs! ;)

Well, it's an interesting idea, but I'm a bit unsure what you'd use this
for, or why it's better than e.g. writing a python file and telling python
to execute that. Maybe you have some more concrete ideas about how to use
this?

-Dave


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk