📜  python创建一组类 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:08.956000             🧑  作者: Mango

代码示例1
class GlobeLearningTable(object):
    def __init__(self,mac,port,dpid):
        self.mac = mac
        self.port = port
        self.dpid = dpid

    def __hash__(self):
        return hash((self.mac, self.port, self.dpid))

    def __eq__(self, other):
        if not isinstance(other, type(self)): return NotImplemented
        return self.mac == other.mac and self.port == other.port and self.dpid == other.dpid