Message253251
I can't believe this issue was closed. Why can't Counter.__lt__(self, other) just be all(self[i] < other[i] for i in self)?
Just because Counter supports weird stuff shouldn't bill it out. To follow that logic, we should also remove Counter.subtract
>>> Counter(a='b') - Counter(a='c')
Traceback (most recent call last):
File "<ipython-input-5-31b2df7f8ff1>", line 1, in <module>
Counter(a='b') - Counter(a='c')
File "/Users/aaronmeurer/anaconda/lib/python3.5/collections/__init__.py", line 709, in __sub__
newcount = count - other[elem]
TypeError: unsupported operand type(s) for -: 'str' and 'str'
It's super annoying that Counter supports all the basic set operations *except* subset. A reminder that this *does* work:
>>> Counter(a=2) | Counter(a=1)
Counter({'a': 2})
And also fails on weird values:
>>> Counter(a='b') | Counter(a='c')
Traceback (most recent call last):
File "<ipython-input-8-f9768ad92117>", line 1, in <module>
Counter(a='b') | Counter(a='c')
File "/Users/aaronmeurer/anaconda/lib/python3.5/collections/__init__.py", line 730, in __or__
if newcount > 0:
TypeError: unorderable types: str() > int() |
|
Date |
User |
Action |
Args |
2015-10-20 20:19:08 | Aaron.Meurer | set | recipients:
+ Aaron.Meurer, rhettinger, mark.dickinson, pitrou, scoder, eric.smith, steven.daprano, r.david.murray, cool-RR, ethan.furman, serhiy.storchaka, Saimadhav.Heblikar, josh.r |
2015-10-20 20:19:07 | Aaron.Meurer | set | messageid: <1445372347.93.0.44665075153.issue22515@psf.upfronthosting.co.za> |
2015-10-20 20:19:07 | Aaron.Meurer | link | issue22515 messages |
2015-10-20 20:19:07 | Aaron.Meurer | create | |
|