[PyQt] PyQt4 and Python 3.0

Paul A. Giannaros paul at giannaros.org
Fri Oct 3 22:20:09 BST 2008


On Fri, Oct 3, 2008 at 9:59 PM, Mark Summerfield <mark at qtrac.eu> wrote:
> On 2008-10-03, Paul A. Giannaros wrote:
>> On Fri, Oct 3, 2008 at 5:08 PM, Mark Summerfield <mark at qtrac.eu> wrote:
>> > On 2008-10-03, Phil Thompson wrote:
>> >> On Fri, 3 Oct 2008 17:11:19 +0200, Detlev Offenbach
>> >
>> > Here's my personal "wish list" for Python 3/PyQt4 (including those that
>> > Phil is going to do as he says above):
>> >
>> > - No QString, only str, plus some static functions for things that str
>> >  doesn't provide, e.g., QString.simplified(s : str) -> str
>> > - No QByteArray, only bytes (or bytearray)
>> > - No QVariant, only object
>> > - Guarantee that "from PyQt4.QtGui import *" and similar will only
>> >  import objects whose name begins with capital Q.
>>
>> That'd be cool. An alternative that I think would be even better
>> would be to provide a "Qt" namespace as per QtRuby and drop the
>> Q prefix from the classes, so Qt.Application, Qt.Widget, &c.
>> That'd dodge the ugly namespace pollution while not causing
>> much more typing.
>
> I like that:-)
>
> But how do we then distinguish QtGui.QApplication from
> QtCore.QApplication? (Or does that even matter?)

What is QtCore.QApplication? Do you mean QtCore.QCoreApplication? ;)
As Qt itself isn't namespaced, the class names don't conflict, even
across modules. That is primarily what makes using PyQt4 without
"import *" so annoying -- having to type things like
"QtSvg.QSvgWidget" is such a bore.

> But I'm not keen on pyqt4 and other lowercase names as Daniel suggested.
> IMO lowercase is for Python's standard packages; I think mixed cased is
> best for own and third party to help avoid clashes.

Disagreed. Most modules and packages (even 3rd party) are lowercase.
Where they are not it's an eye sore. Put all of your own modules in a
"summerfield" package if you're really worried about conflicting :P

>
> --
> Mark Summerfield, Qtrac Ltd, www.qtrac.eu
>    C++, Python, Qt, PyQt - training and consultancy
>        "C++ GUI Programming with Qt 4" - ISBN 0132354160
>
>


More information about the PyQt mailing list