No-brainer? Dictionary keys to variable name?

Greg Ewing see_reply_address at something.invalid
Fri Aug 2 03:43:50 CEST 2002

Max M wrote:

> Christopher Myers wrote:
>> The reason I'm trying to do this is I have a method as follows:
>>     def runSearchTest(self, script_url, f_title="", leftquery="", 
>>                           findwords="titlestext", part="", 
>>                           categories="all", categval=(), 
>>                           topics="all", topicvalue=() ):
>> And I've changed my mind about the implementation.  I'd like to change
>> the parameters to
>>     def runSearchTest(self, oneTest={}):
> def runSearchTest(self, **theDict):

Actually, I think what he wants to do is actually the other
way around -- he wants to be able to *call* it by passing
a dict and have the values in it end up in local variables.

If that's the case, leave the def statement the way
it is, and call it like this:


Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand

More information about the Python-list mailing list