This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dennis Sweeney
Recipients Dennis Sweeney, crypdick
Date 2021-11-30.03:29:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638242977.11.0.668509080665.issue45936@roundup.psfhosted.org>
In-reply-to
Content
This is consistent with the docstrings of the methods:

---------------------------------------------------------------------
>>> help(Counter.__iadd__)
Help on function __iadd__ in module collections:

__iadd__(self, other)
    Inplace add from another counter, keeping only positive counts.
    
    >>> c = Counter('abbb')
    >>> c += Counter('bcc')
    >>> c
    Counter({'b': 4, 'c': 2, 'a': 1})

>>> help(Counter.update)
Help on function update in module collections:

update(self, iterable=None, /, **kwds)
    Like dict.update() but add counts instead of replacing them.
    
    Source can be an iterable, a dictionary, or another Counter instance.
    
    >>> c = Counter('which')
    >>> c.update('witch')           # add elements from another iterable
    >>> d = Counter('watch')
    >>> c.update(d)                 # add elements from another counter
    >>> c['h']                      # four 'h' in which, witch, and watch
    4
---------------------------------------------------------------------


However, it seems Counter.__iadd__ is not mentioned at all at https://docs.python.org/3/library/collections.html#collections.Counter. I think there could be a doc update.
History
Date User Action Args
2021-11-30 03:29:37Dennis Sweeneysetrecipients: + Dennis Sweeney, crypdick
2021-11-30 03:29:37Dennis Sweeneysetmessageid: <1638242977.11.0.668509080665.issue45936@roundup.psfhosted.org>
2021-11-30 03:29:37Dennis Sweeneylinkissue45936 messages
2021-11-30 03:29:36Dennis Sweeneycreate