[PyKDE] QString in PyQt4 - Request for Comments
Giovanni Bajo
rasky at develer.com
Thu Oct 20 02:21:33 BST 2005
James Emerton <ephelon at gmail.com> wrote:
> I'm very in favour of the automatic conversion of QStrings into native
> Python strings. I always thought that multiple string types was an
> annoyance exclusive to C++. I'm also not convinced that performance
> is a compelling argument for the preservation of QString in Python.
>
> See performance data: http://www.gotw.ca/gotw/045.htm
We're not doing a case about COW-strings (ala QString) vs copied strings. We're
just saying that Qt's QString is COW and there are application and real world
scenario exploiting this feature (even if it performs worse in the average
case -- whatever 'average case' might mean in this kind of benchamarks). By
totally hiding QStrings from Python, you're making impossible to replicate this
features. By exposing QString, you're just making a little less convenient some
uses of strings.
In my humble opinion, PyQt should stay as close to C++ Qt as possible. It's a
binding. There are many, many, many places where the Qt API could be made more
Pythonic (just stretch your imagination), but those can find their place in a
library which wraps Qt/PyQt with the goal to provide a more Pythonic API. If
we're going down this road, we can as well totally remove any kind of Qt
container and iterator, and substitute everything with Python concepts. I would
probably like an additional PyQt layer for this, but I believe the basic PyQt
should fly lower.
Giovanni Bajo
More information about the PyQt
mailing list