[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] Method wrappers not shared
From:       "Giovanni Bajo" <rasky () develer ! com>
Date:       2005-10-28 14:05:56
Message-ID: 047601c5dbc8$b74239c0$bf03030a () trilan
[Download RAW message or body]

Phil:

>>> import qt
>>> a = qt.QWidget.acceptDrops
>>> b = qt.QWidget.acceptDrops
>>> a is b
False
>>> id(a), id(b)
(9674384, 9670704)
>>> id(qt.QWidget.acceptDrops)
9831568
>>> id(qt.QWidget.acceptDrops)
9831568

It looks like these method wrappers are recreated each time I need them (I
believe it has to do with the lazy binding construction, right)? Would it be
possible to change SIP so that it preserves existing methods and reuses
them, or is it too much work?

This would be needed for tools like epydoc. Basically, given an object like
qt.QWidget.acceptDrops, epydoc has no way to find it looking within the
module qt, nor it has a way to understand through inspection that
qt.QWidget.acceptDrops come from qt.pyd (the __module__ attribute contains
None, and __objclass__ does not exist).

I know this is really a minor issue, but I would like to get it fixed.
Basically, epydoc can't be used altogether on PyQt applications because it
wastes too much time looking for thousands of duplicates of each and every
method of each and every qt class, in each and every module which does "from
qt import *". Ewww.

Another fix which would be good for me would be to have the __module__
attribute defined for methods. Probably easier to implement than reusing
method objects?
-- 
Giovanni Bajo

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic