Home | History | Annotate | Download | only in python2.7

Lines Matching refs:elements

383     or multiset.  Elements are stored as dictionary keys and their counts
386 >>> c = Counter('abcdeabcdabcaba') # count elements from a string
388 >>> c.most_common(3) # three most common elements
390 >>> sorted(c) # list all unique elements
392 >>> ''.join(sorted(c.elements())) # list elements with repetitions
433 '''Create a new, empty Counter object. And if given, count elements
435 of elements to their counts.
447 'The count of elements not in the Counter is zero.'
452 '''List the n most common elements and their counts from the most
464 def elements(self):
465 '''Iterator over elements repeating each as many times as its count.
468 >>> sorted(c.elements())
474 >>> for factor in prime_factors.elements(): # loop over factors
480 number, elements() will ignore it.
501 >>> c.update('witch') # add elements from another iterable
503 >>> c.update(d) # add elements from another counter
538 >>> c.subtract('witch') # subtract elements from another iterable
539 >>> c.subtract(Counter('watch')) # subtract elements from another counter