[Tutor] Simulating case statement

Jan Eden lists at janeden.org
Tue Sep 27 14:13:58 CEST 2005

Kent Johnson wrote on 27.09.2005:

>Jan Eden wrote:

>>The problem is that the __init__ methods of the respective classes
>>take a different number of parameters - this is why I pass the
>>whole safe_parameters dictionary.
>I think if you pass the dictionary as keyword arguments rather than
>as a single dict you will get what you want.

>page =
>This syntax means, use safe_parameters to populate the keyword
>arguments of the function. Any parameters which are not in
>safe_parameters will be set to their default values, and in other
>calls you can set the parameters as you like. Here is a simple

I see. I did not know that I can use a formal parameter **param in calls - thought I could only do so in function definitions:

def func(**param):
 func(id=1, stuff='blah')
 Thanks for that!
Mac OS X. Because making Unix user-friendly is easier than debugging Windows.

More information about the Tutor mailing list