[PyKDE] Auto-connecting Slots

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sun Jan 29 07:25:42 GMT 2006

On Sun, 29 Jan 2006 03:18:35 +0100
"Giovanni Bajo" <rasky at develer.com> wrote:

> Gerard Vermeulen <gerard.vermeulen at grenoble.cnrs.fr> wrote:
> > from PyQt4.QtCore import *
> > from PyQt4.QtCore import signature as pyqtSignature
> > import signature from signature
> Not a solution, you still have "signature" in the global namespace.

My bad, but:

>>> from PyQt4.QtCore import *
>>> from PyQt4.QtCore import signature as qsignature
>>> del signature
>>> from signature import signature
>>> type(qsignature)
<type 'builtin_function_or_method'>
>>> type(signature)
<type 'function'>


> > I understand that you like to take an unrecommended shortcut and
> > pollute the global namespace (Q-, q-prefix or not), but it is no
> > reason to make life harder for people who don't.
> The Q prefix *is* a namespace. It's the way namespaces have always worked way
> before we were using languages with explicit syntax for namespaces, and the way
> it works in C++ for Qt. Then, if you want to double your namespace by prefixing
> an unneeded QtCore in front of it, and making your source code harder and
> slower to read, that's your choice. The fact that in Python modules are
> namespaces doesn't mean that one has to blindly use them as namespaces even
> when not necessary. Again, I have *never* seen Python code using PyOpenGL with
> the module as a namespace (GL.glBegin), so I just can't see why it should be
> any different for Qt.

from import PyQt4.QtCore import *
hex and oct from QtCore are in the global namespace hiding two Python builtins.
Nobody ever complained. Why single out the rather harmless signature?

There are more than 20 names without a Q or q prefix in QtCore (TT's decision).
Shouldn't they all get a prefix? I don't think so.


More information about the PyQt mailing list