Exemplo n.º 1
0
    def elements(self):
        """
        Iterator over the elements in the counter, repeating as many times as
        counted.

        >>> from brownie.datastructures import Counter
        >>> sorted(Counter('abcabc').elements())
        ['a', 'a', 'b', 'b', 'c', 'c']
        """
        return chain(*starmap(repeat, self.iteritems()))
Exemplo n.º 2
0
def test_starmap():
    add = lambda a, b: a + b
    Assert(list(starmap(add, [(1, 2), (3, 4)]))) == [3, 7]
Exemplo n.º 3
0
def test_starmap():
    add = lambda a, b: a + b
    Assert(list(starmap(add, [(1, 2), (3, 4)]))) == [3, 7]