> From: Phil Thompson <[EMAIL PROTECTED]> > Subject: Re: [PyQt] Almost done with the switch to SIP > To: [email protected] > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="iso-8859-1" > > On Thursday 31 January 2008, Jim Crowell wrote: > > I'm about 80% through converting the Python bindings for Syzygy > > (cross-platform, PC-cluster VR, www.isl.uiuc.edu/syzygy.htm) from SWIG > > to SIP. The source is about 40% smaller, much more readable, and > > framerates are noticeably higher. > > > > SIP rules. > > Interesting. Obviously I know that SIP is better ;) but I didn't realise > the > difference was so significant. > > Phil
I was a bit amazed as well. One caveat, I haven't been using the most up-to-date version of SWIG, I'm stuck on 1.3.21, so some of my problems may have been fixed; I've tried upgrading, but I get mysterious exceptions at runtime and SWIG code is hard to debug. I looked at Boost, but life's too short..after a couple of days of study, SIP looked the easiest route. Once I'd got past the initial hurdle of figuring out how to use SIP (more below), I found that: (1) SIP was easier to use than SWIG, requiring less hand-coding of the Python API; (2) The generated code was clean and readable, in strong contrast to SWIG's, which generates a zillion compiler warnings in g++ and contains lots of "def func(*args)" on the Python side; (3) It's easier to debug, especially at compile time (printing out the relevant line number in the .sip file is nice), but also at runtime (I sometimes have trouble in SWIG with exceptions not referring back to the correct bit of code); (4) It was trivial to override methods in Python and to put related code in separate modules (I think they've actually improved that last one in more recent SWIGs, but the former was a nightmare of callbacks and circular references). > At 23:47 31/01/2008 +0100, Giovanni Bajo wrote: > >On Thu, 2008-01-31 at 14:37 -0600, Jim Crowell wrote: > > At the risk of giving already known information, I found this comparison: > > http://people.web.psi.ch/geus/talks/europython2004_geus.pdf Yes, that was what got me looking hard at SIP in the first place. > It is fairly old but already gives a good idea. The part concerning sip > documentation should be obselete now :-) \ I found the biggest problem was the shortage of working examples, particularly small ones. Outside of PyQt and PyKDE, I couldn't find a single example that worked with SIP 4, and those two projects don't use all of SIP's features. I think one area in which the docs could use expansion would be a discussion of object ownership & when you need to use the various /Transfer.../ annotations. I _think_ I've more or less figured out the rules (I'm not getting dramatic crashes of huge memory leaks--so far), but I don't feel entirely confident of that. Anyway, thanks for the excellent tool. -Jim C. _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
