代码拉取完成,页面将自动刷新
class DEMO:
"""
常量
"""
def __init__(self, v, _type):
if not isinstance(v, dict):
self._value = {_type: v}
else:
self._value = v
def __or__(self, other):
return DEMO(self.value | other.value, '_')
@property
def value(self):
return self._value
def __contains__(self, item):
for _key in item.value.keys():
_value = item.value[_key]
if _key in self._value.keys():
if self._value[_key] == _value:
pass # 可以
else:
return False
else:
return False
return True
def __eq__(self, other):
return True if self._value == other.value else False
a = DEMO(1, "a")
print(a.value)
b = DEMO(2, "b")
c = DEMO(3, "b")
print(((a | b) | c).value)
print(a in (a|b))
print(a == a)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。