我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用UserDict.DictMixin.iteritems()。
def __init__(self, *args, **kwargs): if len(args) > 1: raise TypeError('expected at most 1 arguments, got %d' % len(args)) self._items = [] self._index = {} if args: e = args[0] if callable(getattr(e, 'keys', None)): for k in e.keys(): self._insert(k, e[k]) else: for k, v in e: self._insert(k, v) for k, v in six.iteritems(kwargs): self._insert(k, v)
def __iter__(self): return self._dictionary.iteritems()
def iteritems(self, raw=False): """ Iterate self items. """ for key in self: yield key, self.__getitem__(key, raw=raw)