]> granicus.if.org Git - python/commitdiff
Update example: Counter.subtract returns None, not self
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 17 Dec 2012 12:01:29 +0000 (14:01 +0200)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Mon, 17 Dec 2012 12:01:29 +0000 (14:01 +0200)
1  2 
Doc/library/collections.rst

index 45da4e5541938133e7d837fea9a3dfee2776bbaa,f63a853c870c7e0d540fe0534a427a916eda03e7..6ef114e677981ef84e2091293a38d32aaa77b6e1
@@@ -279,23 -121,24 +279,24 @@@ For example:
              >>> c = Counter(a=4, b=2, c=0, d=-2)
              >>> d = Counter(a=1, b=2, c=3, d=4)
              >>> c.subtract(d)
+             >>> c
              Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})
  
 -      .. versionadded:: 3.2
 +        .. versionadded:: 3.2
  
 -   The usual dictionary methods are available for :class:`Counter` objects
 -   except for two which work differently for counters.
 +    The usual dictionary methods are available for :class:`Counter` objects
 +    except for two which work differently for counters.
  
 -   .. method:: fromkeys(iterable)
 +    .. method:: fromkeys(iterable)
  
 -      This class method is not implemented for :class:`Counter` objects.
 +        This class method is not implemented for :class:`Counter` objects.
  
 -   .. method:: update([iterable-or-mapping])
 +    .. method:: update([iterable-or-mapping])
  
 -      Elements are counted from an *iterable* or added-in from another
 -      *mapping* (or counter).  Like :meth:`dict.update` but adds counts
 -      instead of replacing them.  Also, the *iterable* is expected to be a
 -      sequence of elements, not a sequence of ``(key, value)`` pairs.
 +        Elements are counted from an *iterable* or added-in from another
 +        *mapping* (or counter).  Like :meth:`dict.update` but adds counts
 +        instead of replacing them.  Also, the *iterable* is expected to be a
 +        sequence of elements, not a sequence of ``(key, value)`` pairs.
  
  Common patterns for working with :class:`Counter` objects::