_collections.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:rawr 作者: al14s 项目源码 文件源码
def __setitem__(self, key, value):
        evicted_value = _Null
        with self.lock:
            # Possibly evict the existing value of 'key'
            evicted_value = self._container.get(key, _Null)
            self._container[key] = value

            # If we didn't evict an existing value, we might have to evict the
            # least recently used item from the beginning of the container.
            if len(self._container) > self._maxsize:
                _key, evicted_value = self._container.popitem(last=False)

        if self.dispose_func and evicted_value is not _Null:
            self.dispose_func(evicted_value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号