[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] Proposal for New-style Signals
From: David Boddie <dboddie () trolltech ! com>
Date: 2008-01-24 13:17:55
Message-ID: 200801241417.56034.dboddie () trolltech ! com
[Download RAW message or body]
On Thu Jan 24 10:34:37 GMT 2008, Phil Thompson wrote:
> On Thursday 24 January 2008, David Boddie wrote:
> > I still can't see the attraction of this syntax. I sort of see the point
> > of things like
> >
> > button.clicked.emit()
> >
> > but the stage 2 connect syntax looks inside-out.
>
> Because it's focused on the sender rather than the receiver? Your suggestion
> below does as well.
It's more perverse than that: it's focused on the signal itself. With the
classic syntax
self.connect(button, SIGNAL("clicked()"), self.doSomething)
there's a nice pattern to follow:
connect <sender> <signal> <receiver> <slot>
even when <receiver> and <slot> are combined. Ideally, you could combine the
<sender> and <signal>, but arguments complicate the issue. From a C++ user's
perspective, the self is redundant, but that's the case in lots of places in
Python.
With the signal-centric syntax, I think the meaning is different:
btn.clicked.connect(self.on_clicked)
The signal is saying, "Connect me to this slot."
Not that there's anything wrong with that - it's just a different focus.
David
--
David Boddie
Lead Technical Writer, Trolltech ASA
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic