Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81862
| References | <547EC9E2.8070502@perfect-kreim.de> |
|---|---|
| From | Joshua Landau <joshua@landau.ws> |
| Date | 2014-12-03 13:35 +0000 |
| Subject | Re: Python, C++ interaction |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16536.1417613781.18130.python-list@python.org> (permalink) |
On 3 December 2014 at 08:29, Michael Kreim <michael@perfect-kreim.de> wrote: > > What are you using to wrap C++ classes for Python? > Can you recommend swig? Should I give it another try? > Did I misunderstood ctypes? The PyPy guys would love it if you used CFFI. Cython is also a wonderful approach. There's a lot of support of Cython, but it's also possible to find comparisons in CFFI's favour: http://eev.ee/blog/2013/09/13/cython-versus-cffi/ I've not actually used CFFI, but I've heard good things about it. > Also later on in our code development we would like to pass python lambda > functions to C++. So far I understood that this seems not to be possible. Do > you have any ideas or hints on this topics? This is definitely possible. You'll need to build C++ against CPython and use the Python C API. I've personally found that Boost::Python simplified this dramatically and IMHO if most of your code needs to use Python types directly from C++ I'd scrap Cython altogether and just use Boost. Here's some stuff on callbacks with CFFI: https://cffi.readthedocs.org/en/release-0.5/#callbacks
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Python, C++ interaction Joshua Landau <joshua@landau.ws> - 2014-12-03 13:35 +0000
csiph-web