[Python-ideas] Proposed addtion to urllib.parse in 3.1 (and urlparse in 2.7)

Mart Sõmermaa mrts.pydev at gmail.com
Mon Mar 30 12:04:26 CEST 2009

On Sat, Mar 28, 2009 at 5:26 AM, Guido van Rossum <guido at 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

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

The latter is bad practice anyway.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20090330/fa136c52/attachment.html>

More information about the Python-ideas mailing list