New submission from Frank AK <dropthemasquer...@gmail.com>:

In python 3.10, you couldn't plus two Counter instance, you will got the below 
tip:

```
>>> from collections import Counter
>>> x={1:['a','b','c']}
>>> y={1:['d','e','f'],2:['g']}
>>> Counter(y) + Counter(x)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/frank/github.com/cpython/Lib/collections/__init__.py", line 797, 
in __add__
    if newcount > 0:
TypeError: '>' not supported between instances of 'list' and 'int'
```

But in Python 2, you got the desire result like :

```
>>> from collections import Counter
>>> x={1:['a','b','c']}
>>> y={1:['d','e','f'],2:['g']}
>>> Counter(x) + Counter(y)
Counter({2: ['g'], 1: ['a', 'b', 'c', 'd', 'e', 'f']})
```

----------
messages: 386667
nosy: landpack
priority: normal
severity: normal
status: open
title: Counter not supported add in Python 3.x
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43171>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to