[PyKDE] QString in PyQt4 - Request for Comments

Doug Bell dougb at bellz.org
Fri Oct 21 11:43:06 BST 2005


Giovanni Bajo wrote:

> Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>
> > I'm completely open to making the existing API more Pythonic - this is the
> > time to do it. For example, I did casually float the idea of not using C++
> > types in signal signatures in a previous post - but nobody bit.
> 
> I didn't, because of the reasons explained previously: I believe it would
> just cause more confusion, in the current PyQt design. It's just too handy
> to go looking to the signature in the Qt Assistant and use it. I don't want
> to go check in two different manuals. Until now, PyQt's goal has been to
> adhere as much as possible to Qt, to not confuse existing Qt users and I
> think it's a noble goal. I also understand that this is not ideal for a
> Python-only programmer.

I disagree with Giovanni.  I signal signatures could be made somewhat
more pythonic without the adverse impact.  For example, it could remove
the C++ constant, pointer and reference indicators ("const", "*" and
"&") that Python-only programmers don't really understand.  As long as
the change was consistent, you would not need to use a second manual.
And it would make it easier to remember some signatures without referring
to a manual or wondering whether the parameter was a constant, pointer
or reference.

Regarding the more general questions, I also think that things should be
made a bit more pythonic without deviating much from the Qt API.
Python unicode strings should be returned in place of QString, maybe
with a way of using a switch to get the QString if desired.  And I think
that Python containers should be used in place of Qt's template
containers.

Doug.




More information about the PyQt mailing list