[PyKDE] Update on QStrings and PyQt4
Phil Thompson
phil at riverbankcomputing.co.uk
Tue Oct 25 14:05:39 BST 2005
> Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>
>> A lot of interoperability improvements have been made in current PyQt3
>> snapshots. I've just implemented the buffer interface for QString and
>> the
>> following now work:
>>
>> f = open(QString("Qt"), "r") "foobar".find(QString("bar"))
>> "fooxxx".replace(QString("xxx", QString("bar"))
>>
>> I've already mentioned that the following also now work:
>>
>> s = "Py" + QString("Qt")
>> s = "Py"; s += QString("Qt")
>>
>> Unfortunately, this still doesn't work:
>>
>> QString("foo") in "foobar"
>>
>> I think this is actually a feature/bug in Python - for this operation,
>> unlike other methods like find(), replace() etc., the buffer interface
>> isn't used for some reason. I don't know if other string operations have
>> a
>> similar problem.
>
> Well, this is good news (especially if you're going to make a SIP/PyQt3
> release with this feature), since it's very handy.
> As for the "in" operator, did you report this to the python-dev list?
> Maybe
> it's just a bug and can get fixed.
I'm working on a patch at the moment (with Guido's blessing so it should
go in). If it works Ok then I will go the duck typing route - and it would
also go into PyQt3.
I'll make the patch available for people to play with.
Phil
More information about the PyQt
mailing list