j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
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.
On Fri, Mar 27, 2009 at 7:28 PM, George Sakkis firstname.lastname@example.org wrote:
On Fri, Mar 27, 2009 at 7:36 PM, Terry Reedy email@example.com wrote:
Joel Bender wrote:
It's also possible that the order matters. I think an iterable of tuples (such as returned by dict.items(), but any iterable will do) would be an okay interface.
Ordered dict then :-)
But that, unlike iterable of tuples, would exclude repeated fields, as in Arnaud's example
Note that it's still not general enough as query fields can be repeated, e.g. http://foo.com/search/?q=spam&q=eggs
Repeated fields can be packed together in a tuple/list:
add_query_params('http://foo.com', dict(q=('spam', 'eggs')))
To which one might reply that this would exclude non-consecutive repeated fields,e g. '?q=spam&foo=bar&q=eggs.
To which I would reply that for this 0.01% of cases that require this (a) do it by hand as now or (b) use the same signature as dict() (plus the host in the beginning):
add_query_params(host, mapping_or_iterable=None, **params)
Python-ideas mailing list Pythonfirstname.lastname@example.org http://mail.python.org/mailman/listinfo/python-ideas
-- --Guido van Rossum (home page: http://www.python.org/~guido/)