Created
September 19, 2011 19:25
-
-
Save kra3/1227330 to your computer and use it in GitHub Desktop.
3rd refinement
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 cmp_to_key(col, covert_to_proper_datatype): | |
#Discrad this approch, once we have an option to sort via webmethods, sorting by DB engine is more efficient than doing it ourselves. | |
class K(object): | |
def __init__(self, obj, *args): | |
self.obj = obj | |
def __lt__(self, other): | |
return covert_to_proper_datatype(self.obj[col]) < covert_to_proper_datatype(other.obj[col]) | |
return K |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment