Minor bug in the documentation of collections.Counter.subtract

Hello everyone, I'd like to report a minor inaccuracy in the documentation of collections.Counter.subtract that I found here: http://docs.python.org/2/library/collections.html#collections.Counter.subtra... (and its Python3 analog): The code sample provided there suggests that c.subtract(d) returns a new object:
c = Counter(a=4, b=2, c=0, d=-2)>>> d = Counter(a=1, b=2, c=3, d=4)>>> c.subtract(d)Counter({'a': 3, 'b': 0, 'c': -3, 'd': -6})
In reality, it modifies `c` in place similar to dict.update, and nothing is returned. A possible fix would be:
Best regards, Lev -- Lev Levitsky Institute for Energy Problems of Chemical Physics RAS Laboratory of Physical and Chemical Methods for Structure Analysis Leninsky pr. 38, bld. 2 119334 Moscow Russia tel: +7 499 1378257 fax: +7 499 1378257, +7 499 1378258
participants (2)
-
Andrew Svetlov
-
Lev Levitsky