[PyQt] SIP properties

Kevin Watters kevin at digsby.com
Fri Apr 11 19:05:00 BST 2008


I want to make an option for SIP to autogenerate properties (i.e., GetTitle and
SetTitle just become Title).

I've been reading through transform.c, trying to get a feel for how this might
happen, but I think I'm lacking the "big picture" when it comes to how SIP
implements methods and attribute lookups in general.

I see from some bits in transform.c, mailing list posts, and PyQT's docs on the
usage of "super" that a all attribute lookups are lazy. This is great--I don't
want to lose the positive impact this will have on my app's startup time. But
that means my initial plan for just introspecting on all classes in Python via
startup and assigning properties at module load time is not going to work,
since I think it would mean that I would be accessing EVERY single Get/Set
method, negating any benefit of the lazy lookups.

I know properties are descriptors that call special functions when accessed or
set, and I know how to create them in pure Python. I know that
isinstance(MySipType(), object) == True, which my SIP derived classes are
new-style and can benefit from properties (via descriptors). But I'm missing an
understanding of where this would fit into the transformation process defined
in transform.c.

Can anyone with a better understanding of SIP's internals point me in the right
direction?





More information about the PyQt mailing list