Search code examples
pythonapisortingphotobucket

Sort lexicographically?


I am working on integrating with the Photobucket API and I came across this in their api docs:

"Sort the parameters by name lexographically [sic] (byte ordering, the standard sorting, not natural or case insensitive). If the parameters have the same name, then sort by the value."

What does that mean? How do I sort something lexicographically? byte ordering?

The rest of their docs have been ok so far, but (to me) it seems like this line bears further explanation. Unfortunately there was none to be had.

Anyway, I'm writing the application in Python (it'll eventually become a Django app) in case you want to recommend specific modules that will handle such sorting for me ^_^


Solution

  • The word should be "lexicographic"

    http://www.thefreedictionary.com/Lexicographic

    Dictionary order. Using the letters as they appear in the strings.

    As they suggest, don't fold upper- and lower-case together. Just use the Python built-in list.sort() method.