implement __lt__ to support sorting a list of objects
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
bf1b995908
commit
70ee0f1681
1 changed files with 4 additions and 0 deletions
|
@ -115,6 +115,10 @@ class Object(object):
|
||||||
"""define equality as 'attributes are the same'"""
|
"""define equality as 'attributes are the same'"""
|
||||||
return self.__dict__ == other.__dict__
|
return self.__dict__ == other.__dict__
|
||||||
|
|
||||||
|
def __lt__(self, other):
|
||||||
|
return isinstance(other, self.__class__) and self.name < other.name
|
||||||
|
|
||||||
|
|
||||||
# FIXME: still needed?
|
# FIXME: still needed?
|
||||||
@property
|
@property
|
||||||
def explorer_path(self):
|
def explorer_path(self):
|
||||||
|
|
Loading…
Reference in a new issue