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

Petri Lehtinen petri at digip.org
Thu Oct 6 17:46:37 CEST 2011


Lars Buitinck wrote:
>     >>> from collections import Counter
>     >>> a = Counter([1,2,3])
>     >>> b = a
>     >>> a += Counter([3,4,5])
>     >>> a is b
>     False
> 
> would become
> 
>     # snip
>     >>> a is b
>     True

Sounds like a good idea to me. You should open an issue in the tracker
at http://bugs.python.org/.


More information about the Python-Dev mailing list