Le Mardi 18 Octobre 2005 21:53, Simon Edwards a écrit : > 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). > > cheers,
If it means that the too few people that may care about the copy cost should be ignored then QString can be dropped. However, there is a simple case where the copy can be a problem. I use QTextEdit in a kind of log system (adding text line by line). If QString is dropped, textEdit.setText( textEdit.text() + newLine ) will copy the text twice. For big text, it could be a problem. I am not a QString protector (I also had some problems with it at the begining) but I say we should think twice before removing it. -- Yann Cointepas Tel: +33 1 69 86 78 52 CEA - SHFJ Fax: +33 1 69 86 77 86 4, place du Général Leclerc 91401 Orsay Cedex France _______________________________________________ PyKDE mailing list PyKDE@mats.imk.fraunhofer.de http://mats.imk.fraunhofer.de/mailman/listinfo/pykde