Automatic binding of **kwargs to variables
Peter Hansen
peter at engcorp.com
Sat Oct 29 22:49:58 EDT 2005
lbolognini at gmail.com wrote:
> if name not in expected_form1_kwargs:
> raise ValueError, "Unrecognized keyword" + name
> elif name in expected_form1_kwargs not in kwargs.keys():
> kwargs.update(name=None)
Do you mean this instead?
elif name in expected_form1_kwargs and name not in kwargs:
What you wrote doesn't do what you think it does... it actually tests
for whether True or False is a key in kwargs, depending on whether "name
in expected_form1_kwargs" returns True or False.
-Peter
More information about the Python-list
mailing list