Python的魔术方法-容器对象

实现 __contains__方法

1
2
def __contains__(self, obj):
return [boolean expression]

可用 in 方法检查是否符合要求