psets.py

来自「用python实现的邮件过滤器」· Python 代码 · 共 25 行

PY
25
字号
"""Persistent Sets"""try:    import setsexcept ImportError:    import compatsets as setsimport shelveclass PersistentSet(sets.Set):    def __init__(self, file, iterable=None):        self._data = shelve.open(file)        if iterable is not None:            self._update(iterable)    def __iand__(self, other):        """Update a set with the intersection of itself and another."""        self._binary_sanity_check(other)        ia = (self & other)._data        self._data.clear()        self._data.update(ia)        return self

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?