当前位置: 首页>>代码示例>>Python>>正文


Python MutableMapping.pop方法代码示例

本文整理汇总了Python中collections.MutableMapping.pop方法的典型用法代码示例。如果您正苦于以下问题:Python MutableMapping.pop方法的具体用法?Python MutableMapping.pop怎么用?Python MutableMapping.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在collections.MutableMapping的用法示例。


在下文中一共展示了MutableMapping.pop方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __delitem__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def __delitem__(self, key):
            dict.__delitem__(self, key)
            key, prev, next = self.__map.pop(key)
            prev[2] = next
            next[1] = prev 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:7,代码来源:python2x.py

示例2: popitem

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def popitem(self, last=True):
            if not self:
                raise KeyError('dictionary is empty')
            if last:
                key = next(reversed(self))
            else:
                key = next(iter(self))
            value = self.pop(key)
            return key, value 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:11,代码来源:python2x.py

示例3: __delitem__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def __delitem__(self, key, PREV=0, NEXT=1, dict_delitem=dict.__delitem__):
        'od.__delitem__(y) <==> del od[y]'
        # Deleting an existing item uses self.__map to find the link which is
        # then removed by updating the links in the predecessor and successor nodes.
        if key in self:
            key = self.__lower.pop(key.lower())

        dict_delitem(self, key)
        link = self.__map.pop(key)
        link_prev = link[PREV]
        link_next = link[NEXT]
        link_prev[NEXT] = link_next
        link_next[PREV] = link_prev 
开发者ID:blackye,项目名称:luscan-devel,代码行数:15,代码来源:util.py

示例4: popitem

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def popitem(self, last=True):
        '''od.popitem() -> (k, v), return and remove a (key, value) pair.
        Pairs are returned in LIFO order if last is true or FIFO order if false.

        '''
        if not self:
            raise KeyError('dictionary is empty')
        key = next(reversed(self) if last else iter(self))
        value = self.pop(key)
        return key, value 
开发者ID:blackye,项目名称:luscan-devel,代码行数:12,代码来源:util.py

示例5: __delitem__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def __delitem__(self, key):
        dict.__delitem__(self, key)
        key, prev, next = self.__map.pop(key)
        prev[2] = next
        next[1] = prev 
开发者ID:stamparm,项目名称:maltrail,代码行数:7,代码来源:ordereddict.py

示例6: popitem

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def popitem(self, last=True):
        if not self:
            raise KeyError('dictionary is empty')
        if last:
            key = next(reversed(self))
        else:
            key = next(iter(self))
        value = self.pop(key)
        return key, value 
开发者ID:stamparm,项目名称:maltrail,代码行数:11,代码来源:ordereddict.py

示例7: popitem

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def popitem(self):
                    if not self:
                        raise KeyError
                    key = self._keys.pop()
                    value = dict.pop(self, key)
                    return key, value 
开发者ID:Tautulli,项目名称:Tautulli,代码行数:8,代码来源:_utils.py

示例8: __reduce__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import pop [as 别名]
def __reduce__(self):
                    items = [[k, self[k]] for k in self]
                    inst_dict = vars(self).copy()
                    inst_dict.pop('_keys', None)
                    return self.__class__, (items,), inst_dict

                # Methods with indirect access via the above methods 
开发者ID:Tautulli,项目名称:Tautulli,代码行数:9,代码来源:_utils.py


注:本文中的collections.MutableMapping.pop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。