비교가 가능한 클래스
- 클래스 함수에서 eq, le, lt, ge, gt 등을 구현하면 된다
class Job:
def __init__(self, request_at, elapse_time):
self.request_at = request_at
self.elapse_time = elapse_time
def __value__(self):
return self.elapse_time - self.request_at
def __lt__(self, other):
return self.__value__() < other.__value__()
def __le__(self, other):
return self.__value__() <= other.__value__()
def __gt__(self, other):
return self.__value__() > other.__value__()
def __ge__(self, other):
return self.__value__() <= other.__value__()
def __eq__(self, other):
return self.__value__() == other.__value__()
Area 할만한 것들 ps,
Python,
Til