當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。