Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81876 > unrolled thread
| Started by | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| First post | 2014-12-03 17:17 -0800 |
| Last post | 2014-12-03 17:17 -0800 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Python, C++ interaction Dan Stromberg <drsalists@gmail.com> - 2014-12-03 17:17 -0800
| From | Dan Stromberg <drsalists@gmail.com> |
|---|---|
| Date | 2014-12-03 17:17 -0800 |
| Subject | Re: Python, C++ interaction |
| Message-ID | <mailman.16542.1417655843.18130.python-list@python.org> |
On Wed, Dec 3, 2014 at 12:29 AM, Michael Kreim <michael@perfect-kreim.de> wrote: > Hi, > I did some googleing on extending Python by C++ code but I did not find > something that satisfies me. I gave SWIG a try, but several webpages > disadvised me of using it. Also my small experiments did not work. Now, I > read about ctypes. But as far as I understood it, I have to write a C > wrapper for my C++ code and then a Python wrapper for my C code. That seems > a little complicated. > What are you using to wrap C++ classes for Python? > Can you recommend swig? Should I give it another try? > Did I misunderstood ctypes? > > 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? You've already received some good suggestions. I'll add that ctypes is a bit slow in CPython. Also, you might want to try one or more of the following before resorting to a less-productive language like C++: 1) writing in Cython+CPython (as opposed to wrapping C++ with Cython) 2) using numba+CPython (It's a pretty fast decorator - I've heard it's faster than Cython) 3) shedskin (translates implicitly static Python to C++) 4) pypy (Python with a JIT - ignore RPython) Here's a link I've been maintaining about ways of speeding up Python: http://stromberg.dnsalias.org/~strombrg/speeding-python/ HTH
Back to top | Article view | comp.lang.python
csiph-web