**kwargs
sp00fD
sp00fD at yahoo.com
Tue Jan 18 21:40:45 EST 2000
In article <1263886656-955174 at hypernet.com>,
gmcm at hypernet.com wrote:
> sp00fD writes:
>
> > my.foo(foo="something", bar="something else", this_dict)
>
> Not quite. To call foo with the named args wrapped up as a
> dictionary, you need to use apply:
> apply(foo, ("something", "something else"), this_dict)
Using the above apply(), how does foo know that foo(should have named
that something else) == "something" and bar == "something else", they
appear to be passed as normal args.
Also, how is this dictionary represented after the foo method receives
it? ie. this_dict["wow"] = 1
apply(foo, (....), this_dict)
foo then sees kwargs["wow"] == 1?
> or
> this_dict['foo'] = "something"
> this_dict['bar'] = "something else"
> apply(foo, (), this_dict)
>
> Note that foo cannot tell which of the above ways was used,
> (ie, "foo" and "bar" are not in kwargs when foo examines it).
>
> BTW, while foo-abuse is common, I've never seen it carried to
> such extremes.
I do like foo! ;)
Thanks
>
> - Gordon
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list