[PyKDE] QtCore.Qt and QtGui.Qt

Sundance sundance at ierne.eu.org
Thu Mar 2 11:42:42 GMT 2006


On Thu, Mar 02, 2006 at 10:41:45AM +0000, Phil Thompson wrote:

> A C++ namespace doesn't have an implementation, it just contributes to
> name mangling. In Python they have to be implemented by something so
> there is no direct comparison.

Point! Although I feel Giovanni does have a point as well. Having 
DIFFERENT Qt namespaces lying around is super ungood. Recipe for pain, 
that. I think this is one of those cases where we should polish things 
into submission manually if need there.

I can see several potential approaches.

1) Having the Qt namespace as an external module. Modules are good. 
Modules are designed precisely for the purpose of providing namespaces. 
However, the current PyQt implementation might not make that feasible.

2) Updating QtCore.Qt's __dict__ in the other modules instead of 
creating a new Qt there.

You know,

from QtCore import Qt
Qt.__dict__.update(my_own_Qt_namespace)

... inside each module other than QtCore.

Just an idea anyway. What do you guys think?

-- S.




More information about the PyQt mailing list