-
-
Save ibeauregard/02dc1b80c86f121c9f6e1d6264925e48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def order_by(rows, keys): | |
for key in reversed(keys): | |
def sort_key(row): | |
value = converted(row[key.index]) | |
return (value == '' if key.ascending else value != ''), value | |
rows.sort(key=sort_key, reverse=not key.ascending) | |
return rows |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment