[Twisted-Python] Escaping variable names

Kamil Wasilewski kamil at lucem.pl
Fri Mar 5 13:11:10 EST 2010


> On Friday 05 March 2010, Kamil Wasilewski wrote:
>> > server.doGetCountries(**{
>> >         'country-code': COUNTRYID, 'webapi-key': WEBAPIKEY
>> >         })
>> 
>>           The above gives a syntax error...

> What kind of syntax error? I tested this approached on the interactive
> Python shell and it worked fine there:

>>>> def f(**kvargs):
> ...   print kvargs
> ... 
>>>> f(a = 1, **{'b-c': 12})
> {'a': 1, 'b-c': 12}


    hu, it did work.. must of been a mistake on my part.
    But i tried that method a few times.
    Well that solved a problem ive been sitting on for a while. Thank you!




More information about the Twisted-Python mailing list