[PyKDE] Qt objects subclasses and __dict__ copies
Phil Thompson
phil at riverbankcomputing.co.uk
Mon Mar 20 23:14:45 GMT 2006
On Monday 20 March 2006 1:29 pm, Daniele Varrazzo wrote:
> 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.
It's a bug. Hopefully fixed in tonight's SIP snapshot.
Thanks,
Phil
More information about the PyQt
mailing list