[PyQt] a subclass for a c++ object

Phil Thompson phil at riverbankcomputing.com
Tue Jun 29 18:51:03 BST 2010

On Sat, 26 Jun 2010 13:06:51 -0400, Blaine Bell
<blaine.bell at schrodinger.com> wrote:
> Ah, I see.  That is a very interesting problem.  I would think that it 
> could be solved by using pointers to member functions, but upon reading 
> up on those, it seems like it could be difficult to figure out whether 
> the subclass has implemented that function (the way member functions are 
> implemented could be compiler dependent as well).
> Another way of potentially solving this issue would be to generate a 
> boolean member variable that detects whether the SIP's class function 
> has already been called (to avoid the recursion problem).  I think this 
> would take into account the issue where the base function might call the 
> same function, since its the same object, it would either always have a 
> base function or not.
> This could be a good enhancement for SIP (i.e., to add a boolean member 
> variable for each member function, then check it before the subclass 
> function is called).
> I think having to implement all functions in SIP that are used in C++ 
> has weird dependency issues.  If a programmer is working in just c++, 
> they can break the SIP implementation without knowing it.
> I would like to know what you think.  This enhancement could also be an 
> option for class implementations if you feel it is a significant 
> performance hit (it could be).  It could also be taken out for functions 
> that are used quite a bit (using Annotations in SIP)

The issue isn't detecting the recursion, it's knowing what C++
implementation to call. If it didn't use an explicit scope it would just
end up calling itself - it could detect that with a flag but it still
doesn't know what to do next.


More information about the PyQt mailing list