
__eq__ 함수__eq__는 한 객체를 또 다른 객체와 크기 비교할 때 사용하는 함수이다. 한 객체가 담는 정보가 많은데 유일성을 자동적으로 판단할 수 있게 하려면 아래의 함수를 사용하면 좋다.Example
class point():
def __init__(self):
...
def __eq__(self, other):
if isinstance(other, Point):
if (self.pointname == other.pointName and
self.object_type == other.object_type and
self.device_id == other.device_id and
self.object_id == other.object_id):
return True
else:
return False
class.__lt__(입력변수)class.__le__(입력변수)class.__eq__(입력변수)class.__ne__(입력변수)class.__gt__(입력변수)class.__ge__(입력변수)__hash__ 함수