From: Andrew Svetlov Date: Mon, 17 Dec 2012 12:01:29 +0000 (+0200) Subject: Update example: Counter.subtract returns None, not self X-Git-Tag: v3.3.1rc1~518 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c42398f3bcc1f9ad1a7ac9e2149754a9e6f334a;p=thirdparty%2FPython%2Fcpython.git Update example: Counter.subtract returns None, not self --- 7c42398f3bcc1f9ad1a7ac9e2149754a9e6f334a diff --cc Doc/library/collections.rst index 45da4e554193,f63a853c870c..6ef114e67798 --- a/Doc/library/collections.rst +++ b/Doc/library/collections.rst @@@ -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::