[pyicu-dev] Why SWIG?
Jim Fulton
jim at zope.com
Fri Nov 18 17:53:17 PST 2005
Andi Vajda wrote:
>
...
> No, I don't know Pyrex, I barely know about it.
> Would Pyrex make it as trivial to wrap all this C++ code ?
No. Is that a goal? SWIG makes it trivial to create really bad
Python bindings to things. With a bit of work -- meaning fancy
.i files, you can begin to make nicer interfaces. The nicer
the Python api, the bigger the .i file. I don't really think
that non-trivial .i files are maintainable. I went through this
a few years ago with DCOracle. (The first version of DCOracle
was SWIG based.)
...
> A few months ago, someone recommended I take a look at SIP (in the
> context of PyLucene): http://www.river-bank.demon.co.uk/docs/sip/
> I haven't looked at this too closely yet either.
Ah. I'm not a C++ hacker, but I have the impression that there are
some really nice options for C++ wrapping. I'm not really familiar with
them. It's possible that one of the clever C++ binding tools could be
better than Pyrex.
...
> Could you sum up the pros and cons of Pyrex over SWIG ? (educate me)
- No pointers. :)
- With Pyrex, you write C extensions using an extended form of Python.
It knows about Python and can automate a lot of book keeping that you
would have to yourself with SWIG.
Honestly, I've never used Pyrex myself (I haven't needed to wrap anything
in a while), but I've heard great things about it. Martijn Faassen is using
it with great success to wrap libxml/libxslt:
http://codespeak.net/lxml/
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the pyicu-dev
mailing list