473,326 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Python:C++ interfacing. Tool selection recommendations

Hi,

I am embedding Python with a C++ app and need to provide the Python
world with access to objects & data with the C++ world.

I am aware or SWIG, BOOST, SIP. Are there more?

I welcome comments of the pros/cons of each and recommendations on when
it appropriate to select one over the others.

Thanks in advance.

Alan

Sep 16 '05 #1
7 1294
ad*******@eircom.net wrote:
Hi,

I am embedding Python with a C++ app and need to provide the Python
world with access to objects & data with the C++ world.

I am aware or SWIG, BOOST, SIP. Are there more?

I welcome comments of the pros/cons of each and recommendations on when
it appropriate to select one over the others.


SWIG is rather primitive - to get OO-Style Objects, you need to create
python wrappers yourself, that have an object-reference and call all
generated wrapper functions with that as fisrt argument. SIP is way more
elegant in thast respect. I never tried boost.

Diez
Sep 16 '05 #2
ad*******@eircom.net wrote:
Hi,

I am embedding Python with a C++ app and need to provide the Python
world with access to objects & data with the C++ world.

I am aware or SWIG, BOOST, SIP. Are there more?

I welcome comments of the pros/cons of each and recommendations on when
it appropriate to select one over the others.


boost::python is alien technology. It is amazingly powerful. Once you
learn how to use it it's wonderful, but unless you are comfortable with
modern c++ you may find the learning curve steep.

Sep 16 '05 #3
Neal Becker wrote:
ad*******@eircom.net wrote:

Hi,

I am embedding Python with a C++ app and need to provide the Python
world with access to objects & data with the C++ world.

I am aware or SWIG, BOOST, SIP. Are there more?

I welcome comments of the pros/cons of each and recommendations on when
it appropriate to select one over the others.

boost::python is alien technology. It is amazingly powerful. Once you
learn how to use it it's wonderful, but unless you are comfortable with
modern c++ you may find the learning curve steep.

Note: there is excelent Pyste python prog inside that autogenerates
boost::python code for you from special describtion files (where you can
actualy write AllFromHeader("xxx.h")) and your header files.
Boost::python is the best solution, but the compile time of wrappers.

--
float_dublin
Sep 16 '05 #4
On Fri, 16 Sep 2005 12:04:40 -0400, Neal Becker <nd*******@gmail.com> wrote:
ad*******@eircom.net wrote:
Hi,

I am embedding Python with a C++ app and need to provide the Python
world with access to objects & data with the C++ world.

I am aware or SWIG, BOOST, SIP. Are there more?

I welcome comments of the pros/cons of each and recommendations on when
it appropriate to select one over the others.


boost::python is alien technology. It is amazingly powerful. Once you
learn how to use it it's wonderful, but unless you are comfortable with
modern c++ you may find the learning curve steep.


That last part sounds like a good thing -- if the OP dealing with C++ code,
he should be, or become, comfortable with modern C++.

In my other life as a C++ programmer, I'm thoroughly fed up with people who
keep writing 1980s-style C++ ...

(I wonder, by the way, if it's a good idea to provide a very rich interface
between an application and embedded Python. I have no experience in the
area, but intuition tells me that simplicity and minimalism is important.
How well has this worked out in past projects?)

/Jorgen

--
// Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
\X/ algonet.se> R'lyeh wgah'nagl fhtagn!
Sep 17 '05 #5
> (I wonder, by the way, if it's a good idea to provide a very rich interface
between an application and embedded Python. I have no experience in the
area, but intuition tells me that simplicity and minimalism is important.
How well has this worked out in past projects?)


Check out SIP and the PyQt/PyKDE binding for an example of a
full-fledged C++ library wrapped. But I still think your point is valid :)
Diez
Sep 18 '05 #6
> (I wonder, by the way, if it's a good idea to provide a very rich interface
between an application and embedded Python. I have no experience in the
area, but intuition tells me that simplicity and minimalism is important.
So long as you distinguish between minimalist and the bare minimum. My
experience with using and building systems with embedded interpreters
shows that you can never tell what a user will want to do. If you
provide some functionality that can't be invoked from the embedded
python, you can guarantee that some user somewhere will want that
functionality.

So your "minimal" interface should include the ability to do anything
that the application user can do from whatever interface you
provide. That may include functionality that the environment normally
provides for manipulating your application - unless the environment
provides tools for scripting that functionality.
How well has this worked out in past projects?)


Applications that fail to provide complete functionality have worked
out poorly, usually leaving me frustrated. The most recent example is
Apple's Terminal application in OS X. I want to open a new window,
make it use a font other than the default font, resize the window,
then launch an application in that window passing it an argument from
the command line. This can't be automated because Apple left part of
the functionality out of their scripting interface. As a result, I'm
reduced to using xterm - which has problems of it's own.

<mike
--
Mike Meyer <mw*@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Sep 18 '05 #7
Thanks to all for your postings.

Seems like a spread of opinions here.
I guess SWIG, SIP & BOOST are all valid options which I need to vaidate
in turn....

Alan

Sep 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bezeee | last post by:
At my work we are in the process of building a tool to test an XML based API. Basically, XML in and XML out over http. Currently, there are two engines that do all of the schema validations, xml...
37
by: Ubaidullah Nubar | last post by:
Hi, How well is Python suited for developing database based applications? I am new to Python so please bear with me if some of the questions are too simple. I specifically have the following...
0
by: Mark S Pryor | last post by:
dear c.l.p, I'm posting a Py script to change the wordfile from inside the UE editor. Define this into the adv. tool menu. I found 100 posts in groups.google discussing Python and UltraEdit....
42
by: Fred Ma | last post by:
Hello, This is not a troll posting, and I've refrained from asking because I've seen similar threads get all nitter-nattery. But I really want to make a decision on how best to invest my time....
37
by: Carlos Ribeiro | last post by:
Oh well. A mailing list is not the most appropriate place for rants (a blog is better), but it's still better than keeping it for myself. I'm frustrated. My search for a good IDE to support my...
36
by: Andrea Griffini | last post by:
I did it. I proposed python as the main language for our next CAD/CAM software because I think that it has all the potential needed for it. I'm not sure yet if the decision will get through, but...
0
by: Cees Wesseling | last post by:
For a couple of years I am using now my own data binding tool that can create C++ classes from a DTD. At this moment I need to reconsider this tool since I want to use W3C XML Schemas and need to...
158
by: Giovanni Bajo | last post by:
Hello, I just read this mail by Brett Cannon: http://mail.python.org/pipermail/python-dev/2006-October/069139.html where the "PSF infrastracture committee", after weeks of evaluation, recommends...
3
by: ShambhuHubli | last post by:
Hi all!! .. I am New member to this group. And also new to C/PYTHON API coding. I am trying to have two way communication i,e i am calling from python to C and then from C to python. I have no...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.