本文整理汇总了Python中UserDict.DictMixin.pop方法的典型用法代码示例。如果您正苦于以下问题:Python DictMixin.pop方法的具体用法?Python DictMixin.pop怎么用?Python DictMixin.pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserDict.DictMixin
的用法示例。
在下文中一共展示了DictMixin.pop方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __delitem__
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev
示例2: popitem
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value
示例3: __delitem__
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def __delitem__(self, key):
dict.__delitem__(self, key)
self.__map.pop(key)
self.__order = self.null
示例4: popitem
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value
示例5: __delitem__
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def __delitem__(self, key):
dict.__delitem__(self, key)
key, prev, next = self.__map.pop(key)
prev[2] = next
next[1] = prev
示例6: popitem
# 需要导入模块: from UserDict import DictMixin [as 别名]
# 或者: from UserDict.DictMixin import pop [as 别名]
def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
if last:
key = reversed(self).next()
else:
key = iter(self).next()
value = self.pop(key)
return key, value