[PyKDE] QString in PyQt4 - Request for Comments

Patrick K. O'Brien pobrien at orbtech.com
Tue Oct 18 18:41:10 BST 2005


Phil Thompson wrote:
> I'm wondering whether QString should be dropped in PyQt4 in order to make it 
> more Pythonic.

Sounds good to me.  Any word on when we might expect a functioning
PyQt4?  I don't know about anyone else, but I'm quite anxious to have to
start working with Qt4 as soon as possible.

> At the moment Python strings and unicode strings are automatically converted 
> to QStrings when passed as arguments - so there would be no change there. If 
> a QString was returned by a method or an operator then a unicode string would 
> be returned instead.
> 
> Obviously you would lose all of QString's methods and would have to rely on 
> what Python gives you for manipulating strings.

Never have had a problem with Python strings.

> One of the limitations of QString has been that you couldn't do...
> 
> q = "Py" + QString("Qt")
> 
> ...but with current snapshots you can - so this is an argument for keeping 
> QString as it has become easier to use.

I suppose, but...

> BTW, the following is a consequence of the additional support...
> 
> s = "Py"
> # s is of type str
> s += QString("Qt")
> # s is now of type QString

... I'm not too wild about that.  I doubt that's what I'd be expecting
if I had written that sort of code.

> Comments, opinions welcome.

Having successfully avoided QString in my work with PyQt so far, I'm
wondering what, if any, advantages they offer.  Is there something I'm
not seeing?  If not, I'd rather PyQt4 be more Pythonic.

-- 
Patrick K. O'Brien
Orbtech       http://www.orbtech.com
Schevo        http://www.schevo.org
Pypersyst     http://www.pypersyst.org
PyDispatcher  http://pydispatcher.sourceforge.net




More information about the PyQt mailing list