[Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)
Nick Coghlan
ncoghlan at gmail.com
Mon Mar 30 13:28:21 CEST 2009
Mart Sõmermaa wrote:
> Right you are, sorry for the mental blunder. So what if the signature is
> as follows to support passing query parameters via an ordered dict:
>
> add_query_params(url, params_dict=None, **kwargs)
>
> with the following behaviour:
>
>>>> pd = odict()
>>>> pd['a'] = 1
>>>> pd['b'] = 2
>>>> add_query_params('http://foo.com/?a=0', pd, a=3)
> 'http://foo.com/?a=0&a=1&b=2&a=3 <http://foo.com/?a=0&a=1&b=2&a=3>'
When setting up a dict.update style interface like that, it is often
better to use *args for the two positional arguments - it avoids
accidental name conflicts between the positional arguments and arbitrary
keyword arguments.
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
More information about the Python-ideas
mailing list