[PyQt] Re: SIP newcomer questions/complaints

Kevin Watters kevin at digsby.com
Mon Apr 7 15:44:05 BST 2008

> you will find a cache implementation for PyQt4's configure.py (search > for
"manage_cache"). ... > > You might grab that code and integrate it within your
setup.py. >

This was exactly what I was looking for, and is work great! Thanks!

> > 6) The docs show show no comparisons with similar tools. I'm trying SIP to
see > > if the memory usage of a large wxPython app can be reduced--I have seen
> > comparisons claiming that SIP would be slower than hand generated code, but
> > faster than SWIG. This seems to be a fair assumption, since SWIG generates
lots > > of Python shadow classes, and SIP does not. But some data, or even
anecdotal > > advice about what you're going to get out of SIP compared to SWIG
might be > > useful in the documentation. > > Such statistics are hard to find
because usually developers do not write > bindings twice :)

Well I'm crazy enough to try a re-implementation. I have my reasons ;-) I'll
make sure to document the differences I find somewhere.

> > There are good reasons for using SIP over SWIG, IMO: > > 1) Bindings for
classes and methods are generated *lazily* on first > usage. This means that
the initial import is very fast and does not > consume much memory; and when
the program starts, only the (small) > subset of the wxWidget functions
actually used by the program contribute > to memory occupation.

This is VERY encouraging--high initial memory usage was one of the main reasons
I wanted to check out an alternative to SWIG.

> > 2) SIP is very Python centric, and has many useful features and > shortcuts
for binding C++ code into Python. All the /Transfer/ and > friends stuff, for
instance, is very powerful and elegant (once you get > to understand it fully
:). > > Since I switched to SIP from SWIG, I haven't looked back. > > BTW, I
don't know wxWidgets, but if it uses much STL stuff, let me know > because I
have an unreleased "SIP STL meta-binding", which is basically > a program which
is able to *generate* SIP code for the exact STL subset > (= template
specializations) used by the library you're writing bindings > for; SIP's
support for C++ templates is quite weak, so wrapping > something like of STL
requires abuse of copy & paste, which is automated > by this tool.

wxWidgets actually predates STL, although I think they're coming along to using
it. I'll keep this in mind if I decide to throw the USE_STL switch.

- Kevin

More information about the PyQt mailing list