don't understand MRO

Uwe Mayer merkosh at hadiko.de
Thu Jun 23 11:53:50 EDT 2005


Hi,

I have a subclassed PyQt class: 

class Node(object):
        def move(self, x,y): pass

class CRhomb(QCanvasPolygon, Node): pass

$ python
v2.4.1
>>> CRhomb.mro()
[<class '__main__.CRhomb'>, <class 'qtcanvas.QCanvasPolygon'>, <class
'qtcanvas.QCanvasPolygonalItem'>, <class 'qtcanvas.QCanvasItem'>, <class
'qt.Qt'>, <type 'sip.wrapper'>, <class '__main__.Node'>, <type 'object'>]

>>> a = CRhomb()
>>> a.move(1,2)

This executes also Node.move(a, 1,2)
Why?

Because even QCanvasItem.move delegates the call to the derived object? But
qt.Qt does not have a move() method... how does it get passed on to Node?

Thanks in advance,
Ciao
Uwe     



More information about the Python-list mailing list