[PyQt] Re: SIP newbie question (%MethodCode oddity)

Jim Crowell jaclists at mailbolt.com
Mon Jan 14 15:51:18 GMT 2008


On Thu, 10 Jan 2008 18:00:36 GMT, pyqt-request at riverbankcomputing.com
said:
> 
> On Tuesday 08 January 2008, Jim Crowell wrote:
> >
> > float __float__();
> > %MethodCode
> > 	sipRes = (double)sipCpp->numerator() / sipCpp->denominator();
> > %End
> >
> > Fraction __add__( Fraction );
> > %MethodCode
> > 	sipRes = new Fraction(*a0 + *a1);
> > %End
> >
> > i.e. in the latter case sipCpp is not defined, but that same
> > self-as-c++-object pointer resides in a0. Can anyone tell me why?
> 
> It's an artifact of the way global operators (eg. operator+()) are 
> implemented. I've fixed the documentation to describe the inconsistency.
> 
> Phil

Oh, I get it. Many thanks.
-Jim C.


More information about the PyQt mailing list