This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aaron.Meurer
Recipients Aaron.Meurer, Saimadhav.Heblikar, cool-RR, eric.smith, ethan.furman, josh.r, mark.dickinson, pitrou, r.david.murray, rhettinger, scoder, serhiy.storchaka, steven.daprano
Date 2015-10-20.20:19:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1445372347.93.0.44665075153.issue22515@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2015-10-20 20:19:08Aaron.Meurersetrecipients: + 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:07Aaron.Meurersetmessageid: <1445372347.93.0.44665075153.issue22515@psf.upfronthosting.co.za>
2015-10-20 20:19:07Aaron.Meurerlinkissue22515 messages
2015-10-20 20:19:07Aaron.Meurercreate