[PyKDE] Sip wishlist item: Parameter typechecking enhancement

Phil Thompson phil at riverbankcomputing.co.uk
Mon Jul 18 17:29:31 BST 2005


On Monday 18 July 2005 5:15 pm, Nigel Stewart wrote:
>  > I'm not clear what it is you are really doing, but you can specify
>  > something similar...
>  >     Bar(SIP_PYOBJECT) [(Foo &)];
>  > ...but you still might have to provide %MethodCode.
>
> Phil,
>
> I delved back into the Sip documentation:
>
> method ::= type name ( [argument-list] ) [const]
>          [exceptions] [= 0] [function-annotations] [c++-signature]
>          ; [%MethodCode]
>
> c++-signature ::= [ type ( [argument-list] )]
>
> I can't find any explanation of the c++-signature in
> the documentation, but I'll dig around and see if
> it helps.

The argument-list is the Python signature (ie. how the Python programmer will 
call it). The c++-signature is the real C++ signature. If it is ommitted it 
is assumed to be the same as the Python signature.

> In a nutshell, I want a wrapped constructor to pass
> a wrapped Foo as a PyObject parameter, but I'd prefer
> sip to do the typecheck that PyObject is a Foo, rather
> than trying to deal with it on the C++ side.

How about the GetWrapper annotation?

Phil




More information about the PyQt mailing list