On Sat, Mar 28, 2009 at 5:26 AM, Guido van Rossum <guido@python.org> wrote:
There's way too much bikeshedding in this thread (not picking on you
specifically). I think the originally proposed API is fine, except it
should *not* reject duplicates. To add duplicates you'd just call it
multiple times, e.g. add_query_params(add_query_params(url, a='x'),
a='y'). It's a pretty minor use case anyways.

So be it. I'll open a ticket and provide a patch, tests and documentation.

For people concerned about ordering -- you can always use an odict for passing the kwargs:

add_query_params('http://foo.com', **odict('a' = 1, 'b' = 2))

For people concerned about syntactically more restrictive rules than application/x-www-form-urlencoded allows -- pass in the kwargs via ordinary dict:

add_query_params('http://foo.com', **{'|"-/': 1, '': 2}) # note that py2k allows UTF-8 in argument names anyway

The latter is bad practice anyway.