[PyQt] Fwd: Mixin classes and PyQt4
Hans-Peter Jansen
hpj at urpla.net
Mon Feb 10 21:50:18 GMT 2014
On Montag, 10. Februar 2014 19:47:59 Baz Walter wrote:
> On 10/02/14 18:43, Phil Thompson wrote:
> > On 10-02-2014 6:16 pm, Baz Walter wrote:
> >> Why not simply:
> >>
> >> class A(object):
> >> def sizeHint(self):
> >> print('mixed in!', self.parent())
> >> return super().sizeHint()
> >>
> >> class B(A, QLabel):
> >> pass
> >>
> >> class C(A, QLabel):
> >> pass
> >
> > That was my first reaction, but having to do...
> >
> > class B(A, QLabel)
> >
> > ...rather than...
> >
> > class B(QLabel, A)
> >
> > ...isn't nice.
>
> What would be the point of the second one?
>
> The mixin would always need to go first for subclasses to benefit from
> the reimplemented sizeHint.
Of course.
But writing it will hurt in the fingers and then sting the eyes..
Cheers,
Pete
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140210/ebf11e29/attachment.html>
More information about the PyQt
mailing list