[PyKDE] Connect syntax.

Sundance sundance at ierne.eu.org
Wed Sep 22 18:10:47 BST 2004


Hello,

It occured to me, while I was code-doodling today, that as it currently 
stands, the connect syntax in Python is just a tiny little bit more 
awkward than necessary.

See:

class MyNiftyLittleWidget(QSomeWidget):

  def __init__(self, otherWidget):

    # ...
    # Blah
    # ...
    self.connect(self, PYSIGNAL("kissed()"), otherWidget.blush))


self.connect(self ...) is just a little bit too awkward to fit nicely 
with either Python's cleanliness or Qt's lean efficiency. Makes it a 
fairly uncomfortable spot to be in when someone tries to advertise 
PyGTK as 'cleaner' to your boss. For instance.

Could it be possible to make connect a global function of the qt Python 
module? Please? Like, "connect = QObject.connect" just at the end of 
the wrapper? This would be such a lot more logical and smoother.

Allowing connect to work as an *instance* method would also be WAY cool:
    self.myButton.connect(SIGNAL("clicked()"), self.doSomething)
but it would likely much harder to implement -- although I certainly 
don't put it above Phil's abilities, please don't get me wrong.

What do you think?

-- S., hopeful




More information about the PyQt mailing list