Re: [pygtk] Overriding GObject methods in Python



On Thu, 2006-11-23 at 14:23 +0100, Ed Catmur wrote:
> > Another option would be to forego properties and use a separate
> > vtable 
> > object in the class structure.  The object would encapsulated the 
> > binding of slot to GClosure, and could be exported to Python.  It
> > seems 
> > like reinventing the wheel, though.
> 
> The wheel you're reinventing is GObject signals.

You're right.  I thought of signals as primarily a notification
mechanism.  I assume you're referring to the technique of implementing
the dispatch by emitting the signal, as described at
http://le-hacker.org/papers/gobject/ch05s03.html#id2778308 ?

I'm a bit worried about performance of that.  As far as I can tell, you
cannot optimize for the case of methods implemented in C being called
from C; the emit/notification cycle always marshals the arguments to
GValues and back.  This offers excellent flexibility, but at the price
of efficiency of the common case.

I hoped for a solution where the arguments are marshalled only when
calling actual Python code (a method implemented in a Python subclass),
and simply transmitted when the method is implemented in C.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]