[PyKDE] Qt objects subclasses and __dict__ copies

Daniele Varrazzo daniele.varrazzo at gmail.com
Mon Mar 20 13:29:39 GMT 2006


Hello,

i am fixing the documentation pages generated by Epydoc v. 3.0alpha
when it deals with PyQt subclasses. Currently such pages are bloated
because QObject subclasses receive a copy of the entire superclass in
the dict. For example:

>>> from qt import *
>>> class MyWidget(QWidget):
...     pass

>>> len(MyWidget.__dict__)
234

while ordinary subclasses don't receive superclasses methods in the dict:

>>> class A(object):
...     def foo(self):
...         pass

>>> class B(A):
...     def bar(self):
...         pass

>>> 'foo' in B.__dict__
False
>>> getattr(B, 'foo')
<unbound method B.foo>

This induces Epydoc to think that each method is overridden. The
problem is easy to fix, comparing methods for equality. I'd just like
to know why PyQt object exhibit such characteristic and if any other
framework/large system use the same technique.

I'm not a (Py)Qt expert, so any documentation reference is appreciated. Thanks.

Daniele




More information about the PyQt mailing list