[Python-Dev] counterintuitive behavior (bug?) in Counter with +=

Lars Buitinck L.J.Buitinck at uva.nl
Fri Oct 7 10:53:47 CEST 2011


2011/10/6 Petri Lehtinen <petri at digip.org>:
> Lars Buitinck wrote:
>>     >>> from collections import Counter
>>     >>> a = Counter([1,2,3])
>>     >>> b = a
>>     >>> a += Counter([3,4,5])
>>     >>> a is b
>>     False
>
> Sounds like a good idea to me. You should open an issue in the tracker
> at http://bugs.python.org/.

Done that: http://bugs.python.org/issue13121

-- 
Lars Buitinck
Scientific programmer, ILPS
University of Amsterdam


More information about the Python-Dev mailing list