Is it possible to interoperate with a C++ iostream and python? I'm using boost-python and want to wrap a function that has istream and ostream as arguments.
Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in object types, and they can call C library functions and system calls.
#include in C and C++ is a textual include. import in Python is very different -- no textual inclusion at all! Rather, Python's import lets you access names exported by a self-contained, separately implemented module.
Include() : A function that takes a full Python import path to another URLconf module that should be “included” in this place. Optionally, the application namespace and instance namespace where the entries will be included into can also be specified.
1.1 Streams C/C++ IO are based on streams, which are sequence of bytes flowing in and out of the programs (just like water and oil flowing through a pipe). In input operations, data bytes flow from an input source (such as keyboard, file, network or another program) into the program.
Is http://cci.lbl.gov/cctbx_sources/boost_adaptbx/python_streambuf.h what you are looking for? It comes from the Phenix project.
(license information at http://cci.lbl.gov/cctbx_sources/boost_adaptbx/LICENSE_2_0.txt)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With