[Tutor] Turning kwargs into scalars

Steve Bergman steve at rueb.com
Tue Nov 1 05:52:18 CET 2005


Say I have a function:

def f(self, **kwargs) :

and I want to take the key/value pairs and create a set of variables 
with the names of the keys.

For example, if I say:

f(x=5, y=2)

I want to create local variables 'x' and 'y' in the function, with 
values of 5 and 2 respectively.

How could I do this?

Thanks,
Steve Bergman






More information about the Tutor mailing list