diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py index 0aa0c3e15e9519..53ad1a66878f27 100644 --- a/Lib/collections/__init__.py +++ b/Lib/collections/__init__.py @@ -639,14 +639,15 @@ def elements(self): >>> sorted(c.elements()) ['A', 'A', 'B', 'B', 'C', 'C'] - # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 + Knuth's example for prime factors of 1836: ``2**2 * 3**3 * 17**1``: + >>> import math >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> math.prod(prime_factors.elements()) 1836 Note, if an element's count has been set to zero or is a negative - number, elements() will ignore it. + number, ``elements()`` will ignore it. ''' # Emulate Bag.do from Smalltalk and Multiset.begin from C++.