[Python-Dev] Should urlencode() sort the query parameters (if they come from a dict)?

Glenn Linderman v+python at g.nevcal.com
Sat Aug 18 22:55:48 CEST 2012


On 8/18/2012 11:47 AM, MRAB wrote:
>> I vote -0. The issue can also be addressed with a small and simple
>> helper function that wraps urlparse and compares the query parameter. Or
>> you cann urlencode() with `sorted(qs.items)` instead of `qs` in the
>> application.
>
> Hm. That's actually a good point. 

Seems adequate to me. Most programs wouldn't care about the order, 
because most web frameworks grab whatever is there in whatever order, 
and present it to the web app in their own order.

Programs that care, or which talk to web apps that care, are unlikely to 
want the order from a non-randomized dict, and so have already taken 
care of ordering issues, so undoing the randomization seems like a 
solution in search of a problem (other than for poorly written test cases).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120818/8635ad05/attachment.html>


More information about the Python-Dev mailing list