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


Python MutableMapping.values方法代码示例

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


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

示例1: __repr__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def __repr__(self):
        if not self:
            return '%s()' % self.__class__.__name__
        try:
            items = ', '.join(map('%r: %r'.__mod__, self.most_common()))
            return '%s({%s})' % (self.__class__.__name__, items)
        except TypeError:
            # handle case where values are not orderable
            return '{0}({1!r})'.format(self.__class__.__name__, dict(self))

    # Multiset-style mathematical operations discussed in:
    #       Knuth TAOCP Volume II section 4.6.3 exercise 19
    #       and at http://en.wikipedia.org/wiki/Multiset
    #
    # Outputs guaranteed to only include positive counts.
    #
    # To strip negative and zero counts, add-in an empty counter:
    #       c += Counter() 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:20,代码来源:misc.py

示例2: clear

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def clear(self):
        with self.lock:
            # Copy pointers to all values, then wipe the mapping
            values = list(itervalues(self._container))
            self._container.clear()

        if self.dispose_func:
            for value in values:
                self.dispose_func(value) 
开发者ID:war-and-code,项目名称:jawfish,代码行数:11,代码来源:_collections.py

示例3: getlist

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def getlist(self, key):
        """Returns a list of all the values for the named field. Returns an
        empty list if the key doesn't exist."""
        try:
            vals = _dict_getitem(self, key.lower())
        except KeyError:
            return []
        else:
            if isinstance(vals, tuple):
                return [vals[1]]
            else:
                return vals[1:]

    # Backwards compatibility for httplib 
开发者ID:war-and-code,项目名称:jawfish,代码行数:16,代码来源:_collections.py

示例4: __delitem__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def __delitem__(self, elem):
        'Like dict.__delitem__() but does not raise KeyError for missing values.'
        if elem in self:
            super(Counter, self).__delitem__(elem) 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:6,代码来源:misc.py

示例5: __len__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def __len__(self):
        return len(set().union(*self.maps))     # reuses stored hash values if possible 
开发者ID:Soft8Soft,项目名称:verge3d-blender-addon,代码行数:4,代码来源:misc.py

示例6: __delitem__

# 需要导入模块: from collections import MutableMapping [as 别名]
# 或者: from collections.MutableMapping import values [as 别名]
def __delitem__(self, elem):
            '''Like dict.__delitem__() but does not raise KeyError for
            missing values.'''
            if elem in self:
                dict.__delitem__(self, elem) 
开发者ID:muhanzhang,项目名称:D-VAE,代码行数:7,代码来源:python2x.py


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