[PyKDE] Update on QStrings and PyQt4

Giovanni Bajo rasky at develer.com
Tue Oct 25 13:46:09 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.
-- 
Giovanni Bajo




More information about the PyQt mailing list