On Sat, 10 Aug 2013 21:41:00 -0600, Jason Friedman wrote:
class my_class:
def __init__(self, attr1, attr2):
self.attr1 = attr1 #string
self.attr2 = attr2 #string
def __lt__(self, other):
if self.attr1 other.attr1:
return True
else:
This is a hard question to answer, because your code snippet isn't
clearly extensible to the case where you have ten attributes. What's the
rule for combining them? If instance A has five attributes less than
those of instance B, and five attributes greater than those of instance
B, which
class my_class:
def __init__(self, attr1, attr2):
self.attr1 = attr1 #string
self.attr2 = attr2 #string
def __lt__(self, other):
if self.attr1 other.attr1:
return True
else:
return self.attr2 other.attr2
I will run into problems if
On Sun, Aug 11, 2013 at 4:41 AM, Jason Friedman jsf80...@gmail.com wrote:
class my_class:
def __init__(self, attr1, attr2):
self.attr1 = attr1 #string
self.attr2 = attr2 #string
def __lt__(self, other):
if self.attr1 other.attr1:
return True