[PyKDE] __setitem__ in sip 3.6

Phil Thompson phil at riverbankcomputing.co.uk
Sat Jun 28 21:09:01 BST 2003


On Tuesday 24 June 2003 6:31 pm, Donovan Rebbechi wrote:
> I've been having difficulty getting __setitem__ to work in the new version
> of sip. How does one do this ?
>
> I've already tried this sort of thing:
>
> void __setitem__() /NonLazy/;
>
> void __setitem__() ; // release notes say no more nonlazy ...
>
> and I get complaints about both signatures. But I'm providing %MemberCode
> for this, so I don't see why sip should care what the function sig looks
> like -- when MemberCode is provided, it could be void* __setitem__
> (void*,int,double) for all sip cares.

For operators and special methods SIP now generates the call to sipParseArgs() 
even when you use %MemberCode - so it needs to know the argument types. If 
you are implementing foo.__setitem__() then you need something like...

void __setitem__(int,foo *);

It's not yet possible fully implement a Python like container type. For 
example you can't write SIP code that will implement this...

qsl = QStringList()
qsl[:] = ['abc', 'def']

Over the next few days I will fully implement QStringList as a Python 
container type so that it is a model example, and to identify what needs to 
be added to SIP.

Phil




More information about the PyQt mailing list