views:

128

answers:

1

The official oauth guide makes this recommendation:

It is important not to try and perform the sort operation on some combined string of both name and value as some known separators (such as '=') will cause the sort order to change due to their impact on the string value.

If this is the case, then what would be an efficient way of doing this? A second iteration after the initial sort looking for equal keys?

+4  A: 

Just sort the list of tuples (name, value) -- Python does lexicographic ordering for you.

Alex Martelli