[PyKDE] QString in PyQt4 - Request for Comments

Simon Edwards simon at simonzone.com
Tue Oct 18 20:53:40 BST 2005

On Tuesday 18 October 2005 20:01, Yann Cointepas wrote:
> Le Mardi 18 Octobre 2005 19:24, Phil Thompson a écrit :
> > I'm wondering whether QString should be dropped in PyQt4 in order to make
> > it more Pythonic.
> Would it mean that QString content would always be copied when used in 
> Python ? If yes, copying a QString from a widget to another (for example 
> widget1.setCaption( widget2.caption() ) ) would lead to an unnecessary copy.

True, but how often do you copy a string from one widget to another? I'm 
guessing almost never (never= not often enough to worry about, or be 
performance critical).

The only place that copying might be an issue is in something like Qt's XML 
parser. Otherwise I say drop QString. The whole "add str()" thing is a pain 
in the ass and leads to subtle bugs (espically when you use strings as keys 
in dictionaries).


Simon Edwards             | Guarddog Firewall
simon at simonzone.com       | http://www.simonzone.com/software/
Nijmegen, The Netherlands | "ZooTV? You made the right choice."

More information about the PyQt mailing list