[SciPy-user] FYI: C++ Extensions for Python

Prabhu Ramachandran prabhu_r at users.sf.net
Mon Nov 1 22:58:44 EST 2004


>>>>> "DG" == David Grant <david.grant at telus.net> writes:

[...]
    DG> weave - was going to write a python routine which had some
    DG> small piece weave code.  The weave code would be talking to a
    DG> C++ library or compiled python extension or something.  I was
    DG> able to make a C++ library containing all my C++ code but then
    DG> abandoned it after that, to see if there were simpler methods

This is a common thing you'd need to do with any other approach as
well since all of them would link to your C++ code.  Plus, building a
library out of .o's is straightforward.  I also recommend using SCons
to build your code.

    DG> swig - at first it seemed like a lot of work to copy
[...]

In my experience SWIG "just works" and works fast and well.  Oh, BTW,
if you do have SWIG wrapped code you can weave SWIG wrapped objects
too!  Look at weave/examples/swig2_example.py and read the
docstrings. 

cheers,
prabhu





More information about the SciPy-User mailing list