[docs] [issue24460] urlencode() of dictionary not as expected

Martin Panter report at bugs.python.org
Sat Jun 20 03:29:19 CEST 2015

Martin Panter added the comment:

1. urlencode(): I agree the documentation is unclear. But David Rueter’s suggestion does not help much. I think doseq=True is meant to also work for a mapping query (as in original post), and is not required in the sequence-of-tuples mode if each tuple has a single parameter value. Perhaps something like this could work instead:

“When a sequence of two-element tuples is used as *query*, the first element of each tuple is a key and the second specifies one or more values. If *doseq* is true, each *query* (mapping or sequence) item can specify a sequence of values; if *doseq* is false (the default), each item specifies a single value. The order of parameters in the encoded string will match the order of items in *query* and the order of values in an item.”

2. urlopen(data=...) and Request(data=...): I don’t see the contradiction. It looks like David Rueter’s suggestion only changes the first sentence, to say doseq=True is required to get the urlencoded format, but this is not required. See also Issue 23360 about my own problems with this bit of the documentation.

3. Examples: Again, I do not see why doseq=True should be shown when it is simpler without. But an example of when it is useful would be good, as R David Murray suggested.

nosy: +vadmium

Python tracker <report at bugs.python.org>

More information about the docs mailing list