属性を持つクラスPointがxありyます。オブジェクトを他のタイプのオブジェクトとFalse比較したいと思います。Pointたとえば、Point(0, 1) == None失敗します。
AttributeError: 'NoneType' object has no attribute 'x'
クラス:
class Point():
def __init__(self, x, y):
self.x = x
self.y = y
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __ne__(self, other):
return not self.__eq__(other)
他のオブジェクト タイプと比較するように設定__eq__するにはどうすればよいですか?False