[PyQt] New Feature - Keyword Arguments for Properties and Signals

Henning Schröder henning.schroeder at gmail.com
Fri Sep 11 12:45:51 BST 2009


On Thu, Sep 10, 2009 at 8:42 AM, Phil Thompson
<phil at riverbankcomputing.com> wrote:
> On Thu, 10 Sep 2009 01:25:12 +0300, "Ville M. Vainio" <vivainio at gmail.com>
> wrote:
>> [..]
>> Now, can we have something that does the same thing outside constructor?
>> E.g.
>>
>> act = menu.addAction('blah')
>> act.configure(triggered=self.save, statusTip="Save the document")
>
> Possibly, but it will need a prefix to avoid potential name clashes.
I was thinking about the same when I read the announcement.
The use of keyword arguments looks like a great idea and could
simplify code and even make it faster (less method calls/name lookups
from Python).

As far as I remember configure is used in Tkinter. Currently it is not
used by Qt but I guess
using set_properties or something like it would be safer. A underscore
method name
does not follow the Qt style guide but it follows PEP8 - so it would
be clear that this Python-specific.


Henning


More information about the PyQt mailing list