confusing python urlencode order
Question: okay, so according to <http://docs.python.org/library/urllib.html>

"The order of parameters in the encoded string will match the order of
parameter tuples in the sequence."

except when I try to run this code:

    
    
    import urllib
    values ={'one':'one',
             'two':'two',
             'three':'three',
             'four':'four',
             'five':'five',
             'six':'six',
             'seven':'seven'}
    data=urllib.urlencode(values)
    print data
    

outputs as ...

    
    
    seven=seven&six=six&three=three&two=two&four=four&five=five&one=one
    

7,6,3,2,4,5,1?

That doesn't look like the order of my tuples.


Answer: Dictionaries are inherently unordered because of the way they are implemented.
If you want them to be ordered, you should use a list of tuples instead (or a
tuple of lists, or a tuple of tuples, or a list of lists...):

    
    
    values = [ ('one', 'one'), ('two', 'two') ... ]
    

