Skip to content

Instantly share code, notes, and snippets.

@kra3
Created September 19, 2011 19:24
Show Gist options
  • Save kra3/1227327 to your computer and use it in GitHub Desktop.
Save kra3/1227327 to your computer and use it in GitHub Desktop.
Seconed refinement
def cmp_to_key(col, covert_to_proper_datatype, cmpr = (lambda x, y: x < y)):
class K(object):
def __init__(self, obj, *args):
self.obj = obj
def __lt__(self, other):
return cpmr(covert_to_proper_datatype(self.obj[col]), covert_to_proper_datatype(other.obj[col])) == True
return K
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment