[issue13121] collections.Counter's += copies the entire object

2011-10-19 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue13121] collections.Counter's += copies the entire object

2011-10-19 Thread Roundup Robot
Roundup Robot added the comment: New changeset 5cced40374df by Raymond Hettinger in branch 'default': Issue #13121: Support in-place math operators for collections.Counter(). http://hg.python.org/cpython/rev/5cced40374df -- nosy: +python-dev ___ Pyth

[issue13121] collections.Counter's += copies the entire object

2011-10-18 Thread Raymond Hettinger
Changes by Raymond Hettinger : Added file: http://bugs.python.org/file23457/counter.diff ___ Python tracker ___ ___ Python-bugs-list mailing l

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: I'll add the in-place methods including __iadd__, __isub__, __iand__, and __ior__. If speed is your issue, you should continue to use the update() method which will always be faster because it doesn't have a step to strip zeros and negative values from th

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Lars Buitinck
Lars Buitinck added the comment: If this is not implemented because it is backwards incompat, then it might be useful to add a note to update's docstring explaining that it is much more efficient than +=. I was very surprised that it took *minutes* to add a few thousand moderate-sized Counter

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Mark Dickinson
Changes by Mark Dickinson : -- type: behavior -> feature request ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Mark Dickinson
Changes by Mark Dickinson : -- assignee: -> rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Petri Lehtinen
Petri Lehtinen added the comment: This is slightly backwards incompatible, as some people may depend on the old behavior. Otherwise sounds like a good idea to me. -- nosy: +petri.lehtinen, rhettinger stage: -> patch review versions: +Python 3.3 -Python 3.4 ___

[issue13121] collections.Counter's += copies the entire object

2011-10-07 Thread Lars Buitinck
New submission from Lars Buitinck : I've found some counterintuitive behavior in collections.Counter while hacking on the scikit-learn project [1]. I wanted to use a bunch of Counters to do some simple term counting in a set of documents, roughly as follows: count_total = Counter() for d