[PyKDE] QString in PyQt4 - Request for Comments
David Boddie
david at boddie.org.uk
Thu Oct 20 22:14:33 BST 2005
On Thu, 20 Oct 2005 03:21:33, Giovanni Bajo wrote:
> 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.
I wonder what it means to have a Pythonic API. Apart from transparent use
of native types and classes, how could you make it so much more Pythonic?
Allow direct access to properties as attributes? Change method names to
lower case with underscores? I've got used to the value()/setValue()
method naming convention for dealing with properties!
It's probably instructive to look at other attempts to provide high level
wrappers for existing bindings.
> 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.
I'm sympathetic to the idea of a Pythonic API to Qt but, like you, I think
that it should be provided by a higher level wrapper. There are some really
good reasons for this:
1. The low level interface would still be accessible from Python.
2. Anyone concerned about performance can use the low level interface.
The people who want a higher level API probably hopefully won't be
too bothered by any extra latency that the wrapper will introduce,
and they can still use the low level interface (or C++) if it turns
out to be a problem.
3. The Pythonic wrapper can be done in Python rather than in the binding
layer. This means that it's easier for people to work on it and
customize its behaviour.
4. The wrapper doesn't have to be written by Phil. Hopefully, he should
be happy about that. ;-)
David
More information about the PyQt
mailing list