What kind of signature for this special method?

Luigi Paioro luigi at lambrate.inaf.it
Fri Oct 13 05:14:40 PDT 2006

Thiago Macieira wrote:
> Luigi Paioro wrote:
>>   @dbus.service.method("my.example.Hello")
>>   def mySpecialMethod(self, **args):
>>     # something here with args dictionary
>> I need to add an in_signature argument to the method decoration in order
>> to have a good introspection. Does it exist a way to have such a
>> flexible signature? Any idea? I'm afraid it's impossible...
> For those of us who are not familiar with Python, what does that special 
> method do? What's different about it?

Sorry, you're right! With Python, when you define a function or a class 
method like this:

def example(**args):
   # do something

you can pass to the example() function many key/value pairs which are 
kept as a dictionary. That means that this:

example(a=5, b=10, c="my string")

is passed to the function as a single dictionary args:

args => {a:5, b:10, c:"my string"}

even if you pass it as different single arguments. I don't know the 
details on how this mechanism works.

Thank you for your attention...


More information about the dbus mailing list